triathlon 0.0.11 → 0.0.12
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.
- data/lib/swim.rb +14 -1
- metadata +4 -4
data/lib/swim.rb
CHANGED
@@ -2,9 +2,10 @@ require 'converter'
|
|
2
2
|
require 'time_presenter'
|
3
3
|
class Swim
|
4
4
|
include TimePresenter
|
5
|
-
def initialize(pace_string)
|
5
|
+
def initialize(pace_string, distance=0.0)
|
6
6
|
converter = Converter.new
|
7
7
|
@pace = converter.string_to_seconds pace_string
|
8
|
+
@distance = distance
|
8
9
|
end
|
9
10
|
|
10
11
|
def split(split_distance)
|
@@ -16,9 +17,21 @@ class Swim
|
|
16
17
|
def pace
|
17
18
|
present_seconds_as_string @pace
|
18
19
|
end
|
20
|
+
|
21
|
+
def distance
|
22
|
+
@distance
|
23
|
+
end
|
19
24
|
|
25
|
+
def compute_time(distance=@distance)
|
26
|
+
hundreds = distance.to_f / 100.0
|
27
|
+
time_in_seconds = @pace * hundreds
|
28
|
+
present_seconds_as_string time_in_seconds
|
29
|
+
end
|
20
30
|
private
|
21
31
|
def pace=(pace)
|
22
32
|
@pace = pace.to_f
|
23
33
|
end
|
34
|
+
def distance=(distance)
|
35
|
+
@distance = distance.to_f
|
36
|
+
end
|
24
37
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: triathlon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 12
|
10
|
+
version: 0.0.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Waylon Calabrese
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-22 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|