Sha256: fb83dc1d24ba56a033d076167e5a93b150312e1087bc3fc5116dc88bf1323f84

Contents?: true

Size: 1.23 KB

Versions: 16

Compression:

Stored size: 1.23 KB

Contents

module Runby
  module RunTypes
    # Combines the fast and slow tempo runs into one convenient range of paces
    class TempoRun < RunType
      attr_reader :slow_pace_data, :fast_pace_data

      def description
        'Tempo Run'
      end

      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

      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

      # Used in testing, contains hashes mapping 5K race times with the recommended pace-per-km for this run type.
      class GoldenPaces
        def self.fast
          { '14:00': '03:07', '15:00': '03:20', '20:00': '04:21', '25:00': '05:20', '30:00': '06:19', '35:00': '07:16', '40:00': '08:12', '42:00': '08:35' }
        end

        def self.slow
          { '14:00': '03:18', '15:00': '03:31', '20:00': '04:35', '25:00': '05:37', '30:00': '06:38', '35:00': '07:38', '40:00': '08:36', '42:00': '08:59' }
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
runby_pace-0.6.91 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.6.90 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.6.89 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.6.88 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.6.87 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.5.86 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.5.85 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.4.84 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.4.83 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.4.82 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.4.81 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.4.79 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.4.78 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.4.77 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.3.76 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.2.75 lib/runby_pace/run_types/tempo_run.rb