runby_pace 0.6.145 → 0.6.146
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/runby_pace/distance_unit.rb +15 -7
- 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: ce07ece04ad62c724f57a747d3d7a530ca8ca925
|
4
|
+
data.tar.gz: 9051f2d65022fa56493b3aa12fc6a14eaf0f4679
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad59c1d1f16666cd0c05086bc77d51cf7a8c3e89323f07e0b48b92a8569207fb3045d2b04cc718f00947a233f25f0dedd61ef25f19be7638b2838728da93bca3
|
7
|
+
data.tar.gz: 2a9cd5bf6f551b757b05c55ad23093a0cba8fdc385f7722209cbd7cd816636c943e07c38fc0a3a1f725596166398be82fce2fb7eccab9a2948f4e5005b0dfe41
|
@@ -9,14 +9,11 @@ module Runby
|
|
9
9
|
|
10
10
|
def initialize(unit_of_measure)
|
11
11
|
if unit_of_measure.is_a? Symbol
|
12
|
-
|
13
|
-
@symbol = unit_of_measure
|
14
|
-
@conversion_factor = UOM_DEFINITIONS[@symbol][:conversion_factor]
|
12
|
+
init_from_symbol unit_of_measure
|
15
13
|
elsif unit_of_measure.is_a? String
|
16
|
-
|
17
|
-
@symbol = parsed_uom.symbol
|
18
|
-
@conversion_factor = UOM_DEFINITIONS[@symbol][:conversion_factor]
|
14
|
+
init_from_string unit_of_measure
|
19
15
|
end
|
16
|
+
@conversion_factor = UOM_DEFINITIONS[@symbol][:conversion_factor]
|
20
17
|
@description = UOM_DEFINITIONS[@symbol][:description]
|
21
18
|
freeze
|
22
19
|
end
|
@@ -56,7 +53,6 @@ module Runby
|
|
56
53
|
end
|
57
54
|
|
58
55
|
def self.known_uom?(symbol)
|
59
|
-
# TODO: test
|
60
56
|
UOM_DEFINITIONS.key?(symbol)
|
61
57
|
end
|
62
58
|
|
@@ -84,5 +80,17 @@ module Runby
|
|
84
80
|
# Fun distance unit of measures
|
85
81
|
marathon: { description: 'marathon', description_plural: 'marathons', conversion_factor: 42.1648128,
|
86
82
|
synonyms: %w[marathon] } }.freeze
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def init_from_symbol(unit_of_measure)
|
87
|
+
raise "':#{unit_of_measure}' is an unknown unit of measure" unless DistanceUnit.known_uom? unit_of_measure
|
88
|
+
@symbol = unit_of_measure
|
89
|
+
end
|
90
|
+
|
91
|
+
def init_from_string(unit_of_measure)
|
92
|
+
parsed_uom = DistanceUnit.parse(unit_of_measure)
|
93
|
+
@symbol = parsed_uom.symbol
|
94
|
+
end
|
87
95
|
end
|
88
96
|
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.6.
|
4
|
+
version: 0.6.146
|
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-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,7 +105,7 @@ homepage: https://github.com/tygerbytes/runby-pace
|
|
105
105
|
licenses:
|
106
106
|
- MIT
|
107
107
|
metadata:
|
108
|
-
commit-hash:
|
108
|
+
commit-hash: 65fe0e2369734efe51f94117b434af9cc57849d5
|
109
109
|
post_install_message:
|
110
110
|
rdoc_options: []
|
111
111
|
require_paths:
|