Class: RunbyPace::RunMath

Inherits:
Object
  • Object
show all
Defined in:
lib/runby_pace/run_math.rb

Class Method Summary collapse

Class Method Details

.convert_pace_to_speed(pace) ⇒ Object



4
5
6
7
# File 'lib/runby_pace/run_math.rb', line 4

def self.convert_pace_to_speed(pace)
  pace = RunbyPace::PaceTime.new(pace)
  (60 / pace.total_minutes).round(2)
end

.convert_speed_to_pace(units_per_hour) ⇒ Object



9
10
11
12
# File 'lib/runby_pace/run_math.rb', line 9

def self.convert_speed_to_pace(units_per_hour)
  raise 'units_per_hour must be numeric' unless units_per_hour.is_a? Numeric
  RunbyPace::PaceTime.from_minutes (60.0 / units_per_hour)
end