Module: Calculator
- Included in:
- Calcpace
- Defined in:
- lib/calcpace/calculator.rb
Instance Method Summary collapse
Instance Method Details
#distance(time, pace) ⇒ Object
16 17 18 19 20 |
# File 'lib/calcpace/calculator.rb', line 16 def distance(time, pace) check_time(time) check_time(pace) convert_to_seconds(time).to_f / convert_to_seconds(pace).round(2) end |
#pace(time, distance) ⇒ Object
4 5 6 7 8 |
# File 'lib/calcpace/calculator.rb', line 4 def pace(time, distance) check_time(time) check_distance(distance) convert_to_clocktime(convert_to_seconds(time) / distance.to_f) end |
#total_time(pace, distance) ⇒ Object
10 11 12 13 14 |
# File 'lib/calcpace/calculator.rb', line 10 def total_time(pace, distance) check_time(pace) check_distance(distance) convert_to_clocktime(convert_to_seconds(pace) * distance.to_f) end |