Sha256: 79e296db0c739077e57e342859d9d1afb419c465ecb105eb5c55bd656ad66755
Contents?: true
Size: 716 Bytes
Versions: 3
Compression:
Stored size: 716 Bytes
Contents
module Runby # An assortment of mathematical functions related to running. class RunMath def self.convert_pace_to_speed(pace) pace.as_speed end def self.convert_speed_to_pace(speed) speed.as_pace end def self.distance_traveled(pace, time) # TODO: I sense the need for a refactor... # Consider extracting a new Pace class, which consists of Time + Units # Then move this method to the new class, and give it a better name. pace = Runby::RunbyTime.new(pace) time = Runby::RunbyTime.new(time) divisor = pace.total_minutes / time.total_minutes distance_units_traveled = 1 / divisor return distance_units_traveled end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
runby_pace-0.6.110 | lib/runby_pace/run_math.rb |
runby_pace-0.6.109 | lib/runby_pace/run_math.rb |
runby_pace-0.6.108 | lib/runby_pace/run_math.rb |