runby_pace 0.6.102 → 0.6.103

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2QxZDE1NTc3YTQ3NmY2ODgyN2NmN2ZjZjMzNzg3NWZhZGE2NzM0Nw==
4
+ NjM2NzE4NDQxZTFjMWM1NDIwM2RhZWU2MmI0OGEzOWEyYzg4NTBiMw==
5
5
  data.tar.gz: !binary |-
6
- ZTkwYWYyYjQ5Mzg0ZGYzZmNiZDQ1YzJmMjAxY2IxYmNiYjVkMTM3Mg==
6
+ OThkMjNmYmQ0NWE5MDQwZTg0ODRkZDcwMWJiNjM2MjM5YzkxMDY2MA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmEwYzMwODM0MTcwZGM3YWVhMTE5YmZhN2JiZDgyYTk5YjVhM2JlNzJiMGI3
10
- M2U2ZmQ2NDdhZTJhMmQ3NTVkNWY0ZTgyNWM3OTliZWFkOTdhMDFhYmQyZGI2
11
- YmI2ZjkwNTljMGJjYTY3ZWY2MDFkN2FkZTkxNjE3ZmFiZTgzMTk=
9
+ MWIxYWYwZGU2MmQ3NDMwNGNjNjM3NWNjY2JmNGM1ZWJjYTE4NmRkNGM0YTY5
10
+ MDYxNTU5NGFkZDU5YmFjZmJiNWMyZTJiNzk3MzU5OWU3YWIzN2U5YzA5OTc3
11
+ YmI1MDQ4MzFjYjUwODk0MmRlYjNiY2RjOWJiYzQ2MDhlMTQzNzM=
12
12
  data.tar.gz: !binary |-
13
- YWU1ODBjNDM3MDM2OGFjYmE5MDhhOGE0NTk0Zjk3OWMzYTU1MjIxMDg5ZjVm
14
- ZjU1YWYzZGI3M2ZhZGVlZmVlOTFmMWI4MWM4NGE0NjQ3NmY5ODJiZmFjOTIz
15
- OGQ5M2I3OWY1ZGNjOTUzOGIyMTk0NjBkYjRjODE0N2EwODk5NTc=
13
+ NmJlNTRiY2JmMDA2ZjU1Yjc0YjI3NzQwYjBkZGQ2YzU5YjY0N2NmNmUxYTMz
14
+ OTZjODg2YWU1MTM1YWI1M2VjOGY3MDQ5ZDE5YmUzOWM0ZDZjNTQwMDBkODIy
15
+ Y2M1YTAxODViNGNjM2IwODAzMGQyZGU0NWY1MjZkZDY0N2Q2NTg=
@@ -53,8 +53,12 @@ module Runby
53
53
  { distance: distance, error: error_message }
54
54
  end
55
55
 
56
- def to_s
57
- "#{format('%g', @multiplier.round(2))} #{pluralized_uom}"
56
+ def to_s(format = :long)
57
+ formatted_multiplier = format('%g', @multiplier.round(2))
58
+ case format
59
+ when :short then "#{formatted_multiplier}#{@uom.to_s(:short)}"
60
+ when :long then "#{formatted_multiplier} #{pluralized_uom}"
61
+ end
58
62
  end
59
63
 
60
64
  def pluralized_uom
@@ -19,6 +19,13 @@ module Runby
19
19
  @description = @@_uom_definitions[@symbol][:description]
20
20
  end
21
21
 
22
+ def to_s(format = :long)
23
+ case format
24
+ when :short then @symbol.to_s
25
+ when :long then @description
26
+ end
27
+ end
28
+
22
29
  def self.parse(description)
23
30
  description = description.strip.chomp.downcase
24
31
  found_uom = nil
@@ -14,8 +14,14 @@ module Runby
14
14
  end
15
15
  end
16
16
 
17
- def to_s
18
- "#{time} per #{distance.pluralized_uom}"
17
+ def to_s(format = :long)
18
+ distance_s = @distance.to_s(format)
19
+ leading_zero_regex = /^1 ?/
20
+ distance_s.gsub!(leading_zero_regex, '')
21
+ case format
22
+ when :short then "#{time} p/#{distance_s}"
23
+ when :long then "#{time} per #{distance_s}"
24
+ end
19
25
  end
20
26
 
21
27
  def <=>(other)
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.102
4
+ version: 0.6.103
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ty Walls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-19 00:00:00.000000000 Z
11
+ date: 2016-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,7 +100,7 @@ homepage: https://github.com/tygerbytes/runby-pace
100
100
  licenses:
101
101
  - MIT
102
102
  metadata:
103
- commit-hash: a9b87ccccb726fe5bab0c36f050a9c6f001bf4c7
103
+ commit-hash: 02918a2303e0bc6d20230b68c36aba791bd52a0a
104
104
  post_install_message:
105
105
  rdoc_options: []
106
106
  require_paths: