runby_pace 0.6.100 → 0.6.101

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjFiOGZmNjc3Njg2NTQ0MDc0Y2JkZjM1NTk5YzBjZGRmMThiN2NlOA==
4
+ ZWMxZjRiMDlkYmMzZmE4NjMzOGU4NzI4YTdjZGIwNWE2OWRjZjJhMg==
5
5
  data.tar.gz: !binary |-
6
- ZmNjNTY2ZjQyNTc1NzEyMjVhNGI5ODUxMDYxODc2ZDczMDgxMDY3MA==
6
+ YTYxYTY1ODg1ZTNmMjIzMWRhZjEyNDZmYTUyYzVjMTk5MWU1M2NmMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGZkNTkwMWFlN2E5NTU4MTMwZDlmYzI2NWE2N2Y1NjJhNjQwNTU1M2YzNjU2
10
- Yzk4NDA3MTkzZjIyMWFjMDcwYmRiNjIxODg4Mjc0MDIxOTQxMDYyYmE1MGJl
11
- NWIzYjA1ZjdiMDZjNmFmMzA3NWUwZjQ4ZjcxZjZlMGM2MGZjYjk=
9
+ NDYzZDdhOWYyZDhiZjFkMjBiZTExM2UyNjU0MGFmZTllZjkwZGVjMDllOTBi
10
+ YWU5MTZkNmFjNjAxMDBlMGZmMDNiZGM3NmViMGU3YjU2MGZkNzBmZTVjZGEz
11
+ YjlhZGEyMWI3YzUyNmZjZGY0YzI1YjY0OTI5MzEzNWUxYjUzYTY=
12
12
  data.tar.gz: !binary |-
13
- NjUxNTdlOTJhNTcyODg5ZWQ3Nzg3YWZiMDQzNjdjYWE0M2QwMGEyNWQzOTFl
14
- NWNlZjcwYzMyMWJhYTMxZmViN2UxOWI3NGUyOTFlYWQzODY2ODg3MWFkYzNm
15
- ZjA2ZDM0NmJkODNhYmFjZDBkZmY3MmM1ZTE0NGJhYTkzMGM3MzM=
13
+ MzAyN2Y0ODE3OTVmOWEzMzEyYWUzN2FjNzAwYzhlZjQ3NjhkMDFlMDg5ZmUy
14
+ MTQyNDNjMTRkMGVkYTMzMzc3OTI5YWE4NWIxNmEyN2Q3NzQ5MWY5NDZiMTA3
15
+ MmJlNTA1YTFiMzc3MjQwNmI2ZWQ3YTQ4MDlkZDZhYzdkNjc4NDU=
@@ -9,7 +9,7 @@ module Runby
9
9
  if time_or_pace.is_a? Pace
10
10
  init_from_clone time_or_pace
11
11
  else
12
- @time = Runby::RunbyTime.parse(time_or_pace)
12
+ @time = Runby::RunbyTime.new(time_or_pace)
13
13
  @distance = Runby::Distance.new(distance)
14
14
  end
15
15
  end
@@ -25,6 +25,7 @@ module Runby
25
25
  elsif other.is_a? RunbyTime
26
26
  @time <=> other.time
27
27
  elsif other.is_a? String
28
+ # TODO: Parse as Pace when Pace.parse is available
28
29
  @time <=> RunbyTime.parse(other)
29
30
  end
30
31
  end
@@ -34,8 +35,27 @@ module Runby
34
35
  other_pace = Pace.parse(other_pace)
35
36
  end
36
37
  tolerance = RunbyTime.new(tolerance_time)
37
- # TODO: Clean this up by adding +- to Pace
38
- self.time >= (other_pace.time - tolerance) && self.time <= (other_pace.time + tolerance)
38
+ self >= (other_pace - tolerance) && self <= (other_pace + tolerance)
39
+ end
40
+
41
+ # @param [Pace, RunbyTime] other
42
+ def -(other)
43
+ if other.is_a?(Pace)
44
+ raise 'Pace arithmetic with different units is not currently supported' unless @distance == other.distance
45
+ Pace.new(@time - other.time, @distance)
46
+ elsif other.is_a?(RunbyTime)
47
+ Pace.new(@time - other, @distance)
48
+ end
49
+ end
50
+
51
+ # @param [Pace, RunbyTime] other
52
+ def +(other)
53
+ if other.is_a?(Pace)
54
+ raise 'Pace arithmetic with different units is not currently supported' unless @distance == other.distance
55
+ Pace.new(@time + other.time, @distance)
56
+ elsif other.is_a?(RunbyTime)
57
+ Pace.new(@time + other, @distance)
58
+ end
39
59
  end
40
60
 
41
61
  private
@@ -23,7 +23,7 @@ module Runby
23
23
  end
24
24
 
25
25
  def to_s
26
- if @fast.time == @slow.time
26
+ if @fast == @slow
27
27
  @fast.to_s
28
28
  else
29
29
  "#{@fast.time}-#{@slow.time} per #{@fast.distance.pluralized_uom}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runby_pace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.100
4
+ version: 0.6.101
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ty Walls
@@ -100,7 +100,7 @@ homepage: https://github.com/tygerbytes/runby-pace
100
100
  licenses:
101
101
  - MIT
102
102
  metadata:
103
- commit-hash: 5e175da0082d9fb644dfd56117271a8e51928cb2
103
+ commit-hash: 7dfb3961a521aebbda3d8e5eb920ce054743d9dc
104
104
  post_install_message:
105
105
  rdoc_options: []
106
106
  require_paths: