Class: Runby::RunTypes::TempoRun

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

Overview

Combines the fast and slow tempo runs into one convenient range of paces

Direct Known Subclasses

FastTempoRun, SlowTempoRun

Defined Under Namespace

Classes: GoldenPaces

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTempoRun

Returns a new instance of TempoRun.



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

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

Instance Attribute Details

#fast_pace_calculatorObject (readonly)

Returns the value of attribute fast_pace_calculator.



7
8
9
# File 'lib/runby_pace/run_types/tempo_run.rb', line 7

def fast_pace_calculator
  @fast_pace_calculator
end

#slow_pace_calculatorObject (readonly)

Returns the value of attribute slow_pace_calculator.



7
8
9
# File 'lib/runby_pace/run_types/tempo_run.rb', line 7

def slow_pace_calculator
  @slow_pace_calculator
end

Instance Method Details

#descriptionObject



9
10
11
# File 'lib/runby_pace/run_types/tempo_run.rb', line 9

def description
  'Tempo Run'
end

#explanationObject



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

def explanation
  'Ran at a comfortably hard pace that you could maintain for about an hour, if pressed. However, tempo runs are interval workouts, so you won\'t run for longer than 15-40 minutes per repetition'
end

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



22
23
24
25
26
# File 'lib/runby_pace/run_types/tempo_run.rb', line 22

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