triathlon 0.0.4 → 0.0.5
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/splits.rb +8 -3
- data/test/unit/test_splits.rb +11 -6
- metadata +3 -3
data/lib/splits.rb
CHANGED
@@ -14,6 +14,7 @@ class SplitPresenter
|
|
14
14
|
seconds = (@total_seconds - (minutes * 60.0)).round
|
15
15
|
return "#{minutes}:#{seconds}"
|
16
16
|
end
|
17
|
+
|
17
18
|
end
|
18
19
|
|
19
20
|
class Splits
|
@@ -29,15 +30,19 @@ class Splits
|
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
32
|
-
def
|
33
|
+
def get_four_hundred()
|
33
34
|
return SplitPresenter.new(@total_pace_in_seconds / 4.0)
|
34
35
|
end
|
35
36
|
|
36
|
-
def
|
37
|
+
def get_eight_hundred()
|
37
38
|
return SplitPresenter.new(@total_pace_in_seconds / 2.0)
|
38
39
|
end
|
39
40
|
|
40
|
-
def
|
41
|
+
def get_one_hundred()
|
41
42
|
return SplitPresenter.new(@total_pace_in_seconds / 16.0)
|
42
43
|
end
|
44
|
+
|
45
|
+
def pace
|
46
|
+
return SplitPresenter.new(@total_pace_in_seconds)
|
47
|
+
end
|
43
48
|
end
|
data/test/unit/test_splits.rb
CHANGED
@@ -10,19 +10,24 @@ class TestSplits < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
should 'compute 400m pace' do
|
12
12
|
splits = Splits.new("10:00")
|
13
|
-
|
14
|
-
assert_equal
|
13
|
+
four_hundred = splits.get_four_hundred
|
14
|
+
assert_equal four_hundred.to_s, "2:30"
|
15
15
|
end
|
16
16
|
|
17
17
|
should 'compute 800m pace' do
|
18
18
|
splits = Splits.new("6:53")
|
19
|
-
|
20
|
-
assert_equal
|
19
|
+
eight_hundred = splits.get_eight_hundred
|
20
|
+
assert_equal eight_hundred.to_s, "3:27"
|
21
21
|
end
|
22
22
|
|
23
23
|
should 'compute 100m pace' do
|
24
24
|
splits = Splits.new("5:00")
|
25
|
-
|
26
|
-
assert_equal
|
25
|
+
one_hundred = splits.get_one_hundred
|
26
|
+
assert_equal one_hundred.to_s, "0:19"
|
27
|
+
end
|
28
|
+
|
29
|
+
should 'return original pace' do
|
30
|
+
splits = Splits.new("7:15")
|
31
|
+
assert_equal splits.pace.to_s, "7:15"
|
27
32
|
end
|
28
33
|
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: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Waylon Calabrese
|