Method: Runby::Pace#convert_to

Defined in:
lib/runby_pace/pace.rb

#convert_to(target_distance) ⇒ Object



27
28
29
30
31
32
# File 'lib/runby_pace/pace.rb', line 27

def convert_to(target_distance)
  target_distance = Distance.new(target_distance) unless target_distance.is_a?(Distance)
  return self if @distance == target_distance
  conversion_factor = target_distance / @distance
  Pace.new @time * conversion_factor, target_distance
end