runby_pace 0.6.140 → 0.6.141

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: 56abfe8dad10070a1ce15f6615e2b44c36508536
4
- data.tar.gz: d8faf0b03d0b9a87e62efb8bfee09dffc0ce64f6
3
+ metadata.gz: 1395d5db7e4987b59ea810b4de352a33236c2a33
4
+ data.tar.gz: d866f42b73b2a51bc5c15b1c16f081fff98e69d0
5
5
  SHA512:
6
- metadata.gz: 8d8bd2ae1fce0cb2c9a6cc7c4fa36dc26dc337de516692b0020b05903f84b864b6243b106b43dafd1bca14577688cef0ef6911d97a6ccd08e2734c7791385ef3
7
- data.tar.gz: bf09f4b68dd8402fd5e2443d815bc6bf74c5b9182562b2220ffcb2f5c107e651e4b3c74576a3498227822eb95070d1ffe57d9b6a9dc7915648b666e9bc3569f1
6
+ metadata.gz: eb3405673abb4cb5e230bb719c6f3f60fffbb0c6fc8dbbe291c77883f8456d2b6e82a0da3cb5fd293897788a8e16804b04ec4e2e4fa91ec4b8c9cf30db75761f
7
+ data.tar.gz: c04f1c5e5e0682506c34bc52ec9d01495a8189a42dee8ae71afa800c6867fe867aae6409620887b56beca15ec99deb96d72405a1c434135d96713238a8972126
@@ -6,16 +6,16 @@ module Runby
6
6
  attr_reader :uom, :multiplier
7
7
  def initialize(uom = :km, multiplier = 1)
8
8
  case uom
9
- when Distance
10
- return init_from_clone uom
11
- when DistanceUnit
12
- return init_from_distance_unit uom, multiplier
13
- when String
14
- return init_from_string uom
15
- when Symbol
16
- return init_from_symbol uom, multiplier
17
- else
18
- raise 'Invalid distance unit of measure'
9
+ when Distance
10
+ return init_from_clone uom
11
+ when DistanceUnit
12
+ return init_from_distance_unit uom, multiplier
13
+ when String
14
+ return init_from_string uom
15
+ when Symbol
16
+ return init_from_symbol uom, multiplier
17
+ else
18
+ raise 'Invalid distance unit of measure'
19
19
  end
20
20
  end
21
21
 
@@ -60,8 +60,8 @@ module Runby
60
60
  def to_s(format: :short)
61
61
  formatted_multiplier = format('%g', @multiplier.round(2))
62
62
  case format
63
- when :short then "#{formatted_multiplier} #{@uom.to_s(format: format)}"
64
- when :long then "#{formatted_multiplier} #{@uom.to_s(format: format, pluralize: (@multiplier > 1))}"
63
+ when :short then "#{formatted_multiplier} #{@uom.to_s(format: format)}"
64
+ when :long then "#{formatted_multiplier} #{@uom.to_s(format: format, pluralize: (@multiplier > 1))}"
65
65
  end
66
66
  end
67
67
 
@@ -99,8 +99,7 @@ module Runby
99
99
  # @param [Pace, RunbyTime] other
100
100
  def -(other)
101
101
  if other.is_a?(Pace)
102
- raise 'Pace arithmetic with different units is not currently supported' unless @distance == other.distance
103
- Pace.new(@time - other.time, @distance)
102
+ Pace.new(@time - other.convert_to(@distance).time, @distance)
104
103
  elsif other.is_a?(RunbyTime)
105
104
  Pace.new(@time - other, @distance)
106
105
  end
@@ -109,8 +108,7 @@ module Runby
109
108
  # @param [Pace, RunbyTime] other
110
109
  def +(other)
111
110
  if other.is_a?(Pace)
112
- raise 'Pace arithmetic with different units is not currently supported' unless @distance == other.distance
113
- Pace.new(@time + other.time, @distance)
111
+ Pace.new(@time + other.convert_to(@distance).time, @distance)
114
112
  elsif other.is_a?(RunbyTime)
115
113
  Pace.new(@time + other, @distance)
116
114
  end
@@ -122,8 +120,8 @@ module Runby
122
120
  return Runby::Distance.new(@distance.uom, 0)
123
121
  end
124
122
  divisor = @time.total_minutes / time.total_minutes / @distance.multiplier
125
- distance_units_traveled = Runby::Distance.new(@distance.uom, 1 / divisor)
126
- distance_units_traveled
123
+ distance_covered = Runby::Distance.new(@distance.uom, 1 / divisor)
124
+ distance_covered
127
125
  end
128
126
 
129
127
  private
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.140
4
+ version: 0.6.141
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-03 00:00:00.000000000 Z
11
+ date: 2017-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -104,7 +104,7 @@ homepage: https://github.com/tygerbytes/runby-pace
104
104
  licenses:
105
105
  - MIT
106
106
  metadata:
107
- commit-hash: 01a70d7e4ba6544e76da8e3822fb42674f0568df
107
+ commit-hash: c4c983d998e0dfc43538a963bd657c74ffd8e5f0
108
108
  post_install_message:
109
109
  rdoc_options: []
110
110
  require_paths: