triathlon 0.0.10 → 0.0.11

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.
Files changed (2) hide show
  1. data/lib/swim.rb +24 -0
  2. metadata +4 -3
data/lib/swim.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'converter'
2
+ require 'time_presenter'
3
+ class Swim
4
+ include TimePresenter
5
+ def initialize(pace_string)
6
+ converter = Converter.new
7
+ @pace = converter.string_to_seconds pace_string
8
+ end
9
+
10
+ def split(split_distance)
11
+ ratio = split_distance.to_f / 100.0
12
+ split = @pace * ratio
13
+ present_seconds_as_string split
14
+ end
15
+
16
+ def pace
17
+ present_seconds_as_string @pace
18
+ end
19
+
20
+ private
21
+ def pace=(pace)
22
+ @pace = pace.to_f
23
+ end
24
+ 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: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 10
10
- version: 0.0.10
9
+ - 11
10
+ version: 0.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Waylon Calabrese
@@ -34,6 +34,7 @@ files:
34
34
  - lib/converter.rb
35
35
  - lib/splits.rb
36
36
  - lib/time_presenter.rb
37
+ - lib/swim.rb
37
38
  - test/test_helper.rb
38
39
  - test/unit/test_bike.rb
39
40
  - test/unit/test_converter.rb