runby_pace 0.61.154 → 0.61.155
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.
- checksums.yaml +4 -4
- data/lib/runby_pace/distance.rb +2 -1
- data/lib/runby_pace/distance_unit.rb +3 -2
- data/lib/runby_pace/pace.rb +3 -1
- data/lib/runby_pace/pace_range.rb +1 -1
- data/lib/runby_pace/runby_time.rb +2 -1
- data/lib/runby_pace/speed.rb +5 -4
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1f4113557b6764f4482318812146a3262b015b42
|
|
4
|
+
data.tar.gz: 5f4cdec6c937ea9c88ca6cee9e18706dd297d229
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 913f2201dc935dcd5e862cd608864179645464dba07a3fac19bb53e0507932c11279e7efe3ab6f5683e9190d219d6810759197c20189a9b177f90390ea303b09
|
|
7
|
+
data.tar.gz: 9bba3bf4861a2a8b03ff6bfe0a82248e5767fe2363d48a4e3cc6fc1b28d9eb1fe196094535ab3a49d6153315802e5c126bf9dee87973defccc242b420efcd81e
|
data/lib/runby_pace/distance.rb
CHANGED
|
@@ -68,12 +68,13 @@ module Runby
|
|
|
68
68
|
case format
|
|
69
69
|
when :short then "#{formatted_multiplier} #{@uom.to_s(format: format)}"
|
|
70
70
|
when :long then "#{formatted_multiplier} #{@uom.to_s(format: format, pluralize: (@multiplier > 1))}"
|
|
71
|
+
else raise "Invalid string format #{format}"
|
|
71
72
|
end
|
|
72
73
|
end
|
|
73
74
|
|
|
74
75
|
# @param [Distance, String] other
|
|
75
76
|
def <=>(other)
|
|
76
|
-
raise "Cannot compare Runby::Distance to #{other.class}" unless [Distance, String].include? other.class
|
|
77
|
+
raise "Cannot compare Runby::Distance to #{other.class}(#{other})" unless [Distance, String].include? other.class
|
|
77
78
|
if other.is_a?(String)
|
|
78
79
|
return 0 if to_s == other || to_s(format: :long) == other
|
|
79
80
|
return self <=> Distance.try_parse(other)[:distance]
|
|
@@ -25,6 +25,7 @@ module Runby
|
|
|
25
25
|
case format
|
|
26
26
|
when :short then @symbol.to_s
|
|
27
27
|
when :long then pluralize ? description_plural : @description
|
|
28
|
+
else raise "Invalid string format #{format}"
|
|
28
29
|
end
|
|
29
30
|
end
|
|
30
31
|
|
|
@@ -64,9 +65,9 @@ module Runby
|
|
|
64
65
|
if other.is_a? DistanceUnit
|
|
65
66
|
@symbol == other.symbol
|
|
66
67
|
elsif other.is_a? String
|
|
67
|
-
|
|
68
|
+
self == DistanceUnit.parse(other)
|
|
68
69
|
else
|
|
69
|
-
raise "
|
|
70
|
+
raise "Unable to compare DistanceUnit to #{other.class}(#{other})"
|
|
70
71
|
end
|
|
71
72
|
end
|
|
72
73
|
|
data/lib/runby_pace/pace.rb
CHANGED
|
@@ -37,6 +37,7 @@ module Runby
|
|
|
37
37
|
case format
|
|
38
38
|
when :short then "#{time} p/#{distance_s}"
|
|
39
39
|
when :long then "#{time} per #{distance_s}"
|
|
40
|
+
else raise "Invalid string format #{format}"
|
|
40
41
|
end
|
|
41
42
|
end
|
|
42
43
|
|
|
@@ -76,10 +77,11 @@ module Runby
|
|
|
76
77
|
end
|
|
77
78
|
|
|
78
79
|
def <=>(other)
|
|
80
|
+
raise "Unable to compare Runby::Pace to #{other.class}(#{other})" unless [Pace, RunbyTime, String].include? other.class
|
|
79
81
|
if other.is_a? Pace
|
|
80
82
|
meters_per_minute.round(2) <=> other.meters_per_minute.round(2)
|
|
81
83
|
elsif other.is_a? RunbyTime
|
|
82
|
-
@time <=> other
|
|
84
|
+
@time <=> other
|
|
83
85
|
elsif other.is_a? String
|
|
84
86
|
return 0 if to_s == other || to_s(format: :long) == other
|
|
85
87
|
return 0 if @time == other
|
|
@@ -10,6 +10,7 @@ module Runby
|
|
|
10
10
|
def self.new(time)
|
|
11
11
|
return time if time.is_a? RunbyTime
|
|
12
12
|
return RunbyTime.parse time if time.is_a?(String) || time.is_a?(Symbol)
|
|
13
|
+
return from_minutes(time) if time.is_a? Numeric
|
|
13
14
|
super
|
|
14
15
|
end
|
|
15
16
|
|
|
@@ -109,7 +110,7 @@ module Runby
|
|
|
109
110
|
end
|
|
110
111
|
|
|
111
112
|
def <=>(other)
|
|
112
|
-
raise "
|
|
113
|
+
raise "Unable to compare Runby::RunbyTime to #{other.class}(#{other})" unless [RunbyTime, String].include? other.class
|
|
113
114
|
if other.is_a? RunbyTime
|
|
114
115
|
total_seconds <=> other.total_seconds
|
|
115
116
|
elsif other.is_a? String
|
data/lib/runby_pace/speed.rb
CHANGED
|
@@ -26,7 +26,7 @@ module Runby
|
|
|
26
26
|
when Numeric
|
|
27
27
|
init_from_multiplier(distance_or_multiplier, units)
|
|
28
28
|
else
|
|
29
|
-
raise
|
|
29
|
+
raise "Unable to initialize Runby::Speed from #{distance_or_multiplier}"
|
|
30
30
|
end
|
|
31
31
|
freeze
|
|
32
32
|
end
|
|
@@ -36,6 +36,7 @@ module Runby
|
|
|
36
36
|
case format
|
|
37
37
|
when :short then "#{distance}/ph"
|
|
38
38
|
when :long then "#{distance} per hour"
|
|
39
|
+
else raise "Invalid string format #{format}"
|
|
39
40
|
end
|
|
40
41
|
end
|
|
41
42
|
|
|
@@ -66,9 +67,9 @@ module Runby
|
|
|
66
67
|
end
|
|
67
68
|
|
|
68
69
|
def <=>(other)
|
|
69
|
-
raise "
|
|
70
|
+
raise "Unable to compare Runby::Speed to #{other.class}(#{other})" unless [Speed, String].include? other.class
|
|
70
71
|
if other.is_a? String
|
|
71
|
-
return 0 if to_s == other
|
|
72
|
+
return 0 if to_s == other || to_s(format: :long) == other
|
|
72
73
|
self <=> try_parse(other)[:speed]
|
|
73
74
|
end
|
|
74
75
|
@distance <=> other.distance
|
|
@@ -90,7 +91,7 @@ module Runby
|
|
|
90
91
|
@distance = results[:distance]
|
|
91
92
|
return
|
|
92
93
|
end
|
|
93
|
-
raise "'#{str}' is not recognized as a Speed"
|
|
94
|
+
raise "'#{str}' is not recognized as a Speed or a Distance"
|
|
94
95
|
end
|
|
95
96
|
end
|
|
96
97
|
end
|
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.61.
|
|
4
|
+
version: 0.61.155
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ty Walls
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-07-
|
|
11
|
+
date: 2017-07-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -108,7 +108,7 @@ homepage: https://github.com/tygerbytes/runby-pace
|
|
|
108
108
|
licenses:
|
|
109
109
|
- MIT
|
|
110
110
|
metadata:
|
|
111
|
-
commit-hash:
|
|
111
|
+
commit-hash: f99f2d744c16c3eefe2df019698c65189b5af805
|
|
112
112
|
post_install_message:
|
|
113
113
|
rdoc_options: []
|
|
114
114
|
require_paths:
|