Sha256: 116432ccb4f5655ed8f9226b7b7953b2ab8c3dd23647302f8b3ad8c98b5a3c42

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

module RunbyPace

  module RunTypes

    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

      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

6 entries across 6 versions & 1 rubygems

Version Path
runby_pace-0.2.68 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.2.67 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.2.66 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.2.65 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.2.64 lib/runby_pace/run_types/tempo_run.rb
runby_pace-0.2.63 lib/runby_pace/run_types/tempo_run.rb