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 +8 -8
- data/lib/runby_pace/pace.rb +23 -3
- data/lib/runby_pace/pace_range.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWMxZjRiMDlkYmMzZmE4NjMzOGU4NzI4YTdjZGIwNWE2OWRjZjJhMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTYxYTY1ODg1ZTNmMjIzMWRhZjEyNDZmYTUyYzVjMTk5MWU1M2NmMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDYzZDdhOWYyZDhiZjFkMjBiZTExM2UyNjU0MGFmZTllZjkwZGVjMDllOTBi
|
10
|
+
YWU5MTZkNmFjNjAxMDBlMGZmMDNiZGM3NmViMGU3YjU2MGZkNzBmZTVjZGEz
|
11
|
+
YjlhZGEyMWI3YzUyNmZjZGY0YzI1YjY0OTI5MzEzNWUxYjUzYTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzAyN2Y0ODE3OTVmOWEzMzEyYWUzN2FjNzAwYzhlZjQ3NjhkMDFlMDg5ZmUy
|
14
|
+
MTQyNDNjMTRkMGVkYTMzMzc3OTI5YWE4NWIxNmEyN2Q3NzQ5MWY5NDZiMTA3
|
15
|
+
MmJlNTA1YTFiMzc3MjQwNmI2ZWQ3YTQ4MDlkZDZhYzdkNjc4NDU=
|
data/lib/runby_pace/pace.rb
CHANGED
@@ -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.
|
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
|
-
|
38
|
-
|
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
|
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.
|
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:
|
103
|
+
commit-hash: 7dfb3961a521aebbda3d8e5eb920ce054743d9dc
|
104
104
|
post_install_message:
|
105
105
|
rdoc_options: []
|
106
106
|
require_paths:
|