Class: Runby::RunTypes::LongRun

Inherits:
Runby::RunType show all
Defined in:
lib/runby_pace/run_types/long_run.rb

Overview

Arguably one of the most important run types, the “long run” is harder than an “easy run”, but easier than

a "distance run". It should remain conversational.

Defined Under Namespace

Classes: GoldenPaces

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLongRun

Returns a new instance of LongRun.



12
13
14
15
# File 'lib/runby_pace/run_types/long_run.rb', line 12

def initialize
  @fast_pace_calculator = PaceCalculator.new(GoldenPaces.fast, 2.125)
  @slow_pace_calculator = PaceCalculator.new(GoldenPaces.slow, 1.55)
end

Instance Attribute Details

#fast_pace_calculatorObject (readonly)

Returns the value of attribute fast_pace_calculator.



6
7
8
# File 'lib/runby_pace/run_types/long_run.rb', line 6

def fast_pace_calculator
  @fast_pace_calculator
end

#slow_pace_calculatorObject (readonly)

Returns the value of attribute slow_pace_calculator.



6
7
8
# File 'lib/runby_pace/run_types/long_run.rb', line 6

def slow_pace_calculator
  @slow_pace_calculator
end

Instance Method Details

#descriptionObject



8
9
10
# File 'lib/runby_pace/run_types/long_run.rb', line 8

def description
  'Long Run'
end

#lookup_pace(five_k_time, distance_units = :km) ⇒ Object



17
18
19
20
21
# File 'lib/runby_pace/run_types/long_run.rb', line 17

def lookup_pace(five_k_time, distance_units = :km)
  fast = @fast_pace_calculator.calc(five_k_time, distance_units)
  slow = @slow_pace_calculator.calc(five_k_time, distance_units)
  PaceRange.new(fast, slow)
end