runby_pace 0.61.154 → 0.61.155

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 606c3c91ef5137d4eb17d80fec2e6abc1de92110
4
- data.tar.gz: 512fafad4f8f3f04a08274e3b63a34935bf25be9
3
+ metadata.gz: 1f4113557b6764f4482318812146a3262b015b42
4
+ data.tar.gz: 5f4cdec6c937ea9c88ca6cee9e18706dd297d229
5
5
  SHA512:
6
- metadata.gz: 95c099f7c0e5257f68136e32065fb6149c2f06bd5fdc0cfb3fa97b09b52c7030b8a7fe62a42bcdbb0ced3e82bcdba31081dc44f6fab46c027dc164dfcd1041e0
7
- data.tar.gz: 35cf6b718b23ddd67b0c4bcf3af08ad945041cfa00cd3f1d37cf3d05e4c3e52c1ee9245536c0444d428c2a636a5d590cb9c31a2594e442b0e5474cbd3eec29e6
6
+ metadata.gz: 913f2201dc935dcd5e862cd608864179645464dba07a3fac19bb53e0507932c11279e7efe3ab6f5683e9190d219d6810759197c20189a9b177f90390ea303b09
7
+ data.tar.gz: 9bba3bf4861a2a8b03ff6bfe0a82248e5767fe2363d48a4e3cc6fc1b28d9eb1fe196094535ab3a49d6153315802e5c126bf9dee87973defccc242b420efcd81e
@@ -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
- @symbol == DistanceUnit.parse(other)
68
+ self == DistanceUnit.parse(other)
68
69
  else
69
- raise "Error comparing DistanceUnit to #{other.class}"
70
+ raise "Unable to compare DistanceUnit to #{other.class}(#{other})"
70
71
  end
71
72
  end
72
73
 
@@ -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.time
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
@@ -26,7 +26,7 @@ module Runby
26
26
  if @fast == @slow
27
27
  @fast.to_s(format: format)
28
28
  else
29
- @fast.to_s(format: format).sub("#{@fast.time}", "#{@fast.time}-#{@slow.time}")
29
+ @fast.to_s(format: format).sub(@fast.time.to_s, "#{@fast.time}-#{@slow.time}")
30
30
  end
31
31
  end
32
32
  end
@@ -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 "Cannot compare Runby::RunbyTime to #{other.class}" unless [RunbyTime, String].include? other.class
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
@@ -26,7 +26,7 @@ module Runby
26
26
  when Numeric
27
27
  init_from_multiplier(distance_or_multiplier, units)
28
28
  else
29
- raise 'Unable to initialize Runby::Speed'
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 "Cannot compare Runby::Speed to #{other.class}" unless [Speed, String].include? other.class
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.to_s || to_s(format: :long) == other.to_s(format: :long)
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.154
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-22 00:00:00.000000000 Z
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: 09fc1b1dbcb0402ebffe9a33901f65105ffb04aa
111
+ commit-hash: f99f2d744c16c3eefe2df019698c65189b5af805
112
112
  post_install_message:
113
113
  rdoc_options: []
114
114
  require_paths: