Class: Runby::RunTypes::DistanceRun
- Inherits:
-
Runby::RunType
- Object
- Runby::RunType
- Runby::RunTypes::DistanceRun
- Defined in:
- lib/runby_pace/run_types/distance_run.rb
Overview
Defines the venerable “distance run”, the backbone of any distance running program.
Most of your runs should be at this pace. Harder than an "easy run" but still conversational.
Defined Under Namespace
Classes: GoldenPaces
Instance Attribute Summary collapse
-
#fast_pace_calculator ⇒ Object
readonly
Returns the value of attribute fast_pace_calculator.
-
#slow_pace_calculator ⇒ Object
readonly
Returns the value of attribute slow_pace_calculator.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize ⇒ DistanceRun
constructor
A new instance of DistanceRun.
- #lookup_pace(five_k_time, distance_units = :km) ⇒ Object
Constructor Details
#initialize ⇒ DistanceRun
Returns a new instance of DistanceRun.
12 13 14 15 |
# File 'lib/runby_pace/run_types/distance_run.rb', line 12 def initialize @fast_pace_calculator = PaceCalculator.new(GoldenPaces.fast, 3.675) @slow_pace_calculator = PaceCalculator.new(GoldenPaces.slow, 2.175) end |
Instance Attribute Details
#fast_pace_calculator ⇒ Object (readonly)
Returns the value of attribute fast_pace_calculator.
6 7 8 |
# File 'lib/runby_pace/run_types/distance_run.rb', line 6 def fast_pace_calculator @fast_pace_calculator end |
#slow_pace_calculator ⇒ Object (readonly)
Returns the value of attribute slow_pace_calculator.
6 7 8 |
# File 'lib/runby_pace/run_types/distance_run.rb', line 6 def slow_pace_calculator @slow_pace_calculator end |
Instance Method Details
#description ⇒ Object
8 9 10 |
# File 'lib/runby_pace/run_types/distance_run.rb', line 8 def description 'Distance Run' end |
#lookup_pace(five_k_time, distance_units = :km) ⇒ Object
17 18 19 20 21 |
# File 'lib/runby_pace/run_types/distance_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 |