Class: RunbyPace::RunTypes::TempoRun

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

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.



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

def initialize
  @fast_pace_data = PaceData.new(GoldenPaces.fast[:'14:00'], GoldenPaces.fast[:'42:00'], 4.025)
  @slow_pace_data = PaceData.new(GoldenPaces.slow[:'14:00'], GoldenPaces.slow[:'42:00'], 3.725)
end

Instance Attribute Details

#fast_pace_dataObject (readonly)

Returns the value of attribute fast_pace_data.



4
5
6
# File 'lib/runby_pace/run_types/tempo_run.rb', line 4

def fast_pace_data
  @fast_pace_data
end

#slow_pace_dataObject (readonly)

Returns the value of attribute slow_pace_data.



4
5
6
# File 'lib/runby_pace/run_types/tempo_run.rb', line 4

def slow_pace_data
  @slow_pace_data
end

Instance Method Details

#descriptionObject



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

def description
  'Tempo Run'
end

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



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

def pace(five_k_time, distance_units = :km)
  fast = @fast_pace_data.calc(five_k_time, distance_units)
  slow = @slow_pace_data.calc(five_k_time, distance_units)
  PaceRange.new(fast, slow)
end