runby_pace 0.6.97 → 0.6.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/runby_pace/runby_time.rb +8 -29
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTRjNzMyZmIwMThhMWViYjIyODYyYzAwMTQ5MjU5OTRjYmYwZDRmNA==
4
+ NDg3OTI1YjYyN2E2YjM4M2FkNDE5ZmVlYWE5ZWJjZTVmZGJiMjkxNw==
5
5
  data.tar.gz: !binary |-
6
- MWEwZTc3MzBkMjMwMDUyMjlkOWQ1OTI1ODk2MTdkY2ZmNTczMmNlMw==
6
+ MWVmZWQxZjA3MWY2MGE0MjEwYzgwMmM0ZWQ1YTY4MTlhNzQ0YjljZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmE2ZDQ5NDAwYzFiMTFkNDA0OTlmNDI4NjE0OThiZDA5MDY1MWQzNWE2YjJl
10
- YmYzYTYxZmZiNDNhODM4Nzg0ZjI0ZjFmNmVjYTNhYjUxM2IxYjhkOTQyOGQw
11
- OGUxYmUxN2M5ZDkyNzE4ZTJkNWNmYzhjZGY1NTI0OWU5MTYxNTM=
9
+ YjUxOGIwYWMwMzM4ZmZiZTEzNzM3NzhmZjZlYzEyODRiNTVlMzY5NmI4N2Rm
10
+ MDYzZDQwOGY4OGFmM2E2OWU2ZDcwODYyMGJjNzE2OWIzMWE1YTM0N2RiMjlh
11
+ YmEyM2RlMzY5MGQxMGYyNjg2NjQwY2U1MzY3NWM1YzYwNmNhYmM=
12
12
  data.tar.gz: !binary |-
13
- MmVjMTU4Y2JjNWUzMGE4MzNiOGMwMjFlYzMzNzZhODI2MzI1Y2RjNmM0ZWNm
14
- OTVlMTk2YTY5NjI2OTlkNzM2MDcxNjNhZWNmNDA4YTk0N2QxZDRmZDBlYmU3
15
- ZDAyNjg4ZGY4OTg2YjgwMmFiZjhmMWY3NmUxMjc2MjkxNzc3YmY=
13
+ YmExNWViMjJlODFmYmY3Y2ZlODJmMzEzYzNhOWQ5ZDUxMWZiZTE2NWY0NTlj
14
+ ZDZiMDZiYzVmNDYxMTliMmRmYzNiMDM5NGVmNGE3MTY2M2RmZjliZTYyM2Yz
15
+ MGNjNDcwNzQ3NWQ1NDA2YjBlZGEyYTE0NjNmNThkNjgyNjBhOGQ=
@@ -1,6 +1,8 @@
1
1
  module Runby
2
2
  # Represents a human-readable time in the format MM:ss
3
3
  class RunbyTime
4
+ include Comparable
5
+
4
6
  attr_reader :time_s, :minutes_part, :seconds_part
5
7
 
6
8
  def initialize(time)
@@ -93,11 +95,12 @@ module Runby
93
95
  end
94
96
  end
95
97
 
96
- def ==(other)
97
- if other.is_a?(RunbyTime)
98
- total_seconds == other.total_seconds
99
- elsif other.is_a?(String)
100
- @time_s == other
98
+ def <=>(other)
99
+ if other.is_a? RunbyTime
100
+ total_seconds <=> other.total_seconds
101
+ elsif other.is_a? String
102
+ return 0 if @time_s == other
103
+ total_seconds <=> parse(other).total_seconds
101
104
  end
102
105
  end
103
106
 
@@ -109,30 +112,6 @@ module Runby
109
112
  self >= (other_time - tolerance) && self <= (other_time + tolerance)
110
113
  end
111
114
 
112
- def >(other)
113
- if other.is_a?(RunbyTime)
114
- total_seconds > other.total_seconds
115
- end
116
- end
117
-
118
- def >=(other)
119
- if other.is_a?(RunbyTime)
120
- total_seconds >= other.total_seconds
121
- end
122
- end
123
-
124
- def <(other)
125
- if other.is_a?(RunbyTime)
126
- total_seconds < other.total_seconds
127
- end
128
- end
129
-
130
- def <=(other)
131
- if other.is_a?(RunbyTime)
132
- total_seconds <= other.total_seconds
133
- end
134
- end
135
-
136
115
  private
137
116
 
138
117
  # @param [Hash] params
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runby_pace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.97
4
+ version: 0.6.98
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ty Walls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-17 00:00:00.000000000 Z
11
+ date: 2016-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,7 +100,7 @@ homepage: https://github.com/tygerbytes/runby-pace
100
100
  licenses:
101
101
  - MIT
102
102
  metadata:
103
- commit-hash: 5e1379080b4314c7009d6c63015cc05c607c3aa7
103
+ commit-hash: 67290a61b651d8cb0acad0687863fe404513603e
104
104
  post_install_message:
105
105
  rdoc_options: []
106
106
  require_paths: