Sha256: f81f5687619cb6dafbe27e7f41f20044aa11e855eb11adddcec60a17b06450e5

Contents?: true

Size: 1.21 KB

Versions: 16

Compression:

Stored size: 1.21 KB

Contents

module Runby
  module RunTypes
    # An easy run is basically a jog. It should be conversational.
    class EasyRun < RunType
      attr_reader :slow_pace_data, :fast_pace_data

      def description
        'Easy Run'
      end

      def initialize
        @fast_pace_data = PaceData.new(GoldenPaces.fast[:'14:00'], GoldenPaces.fast[:'42:00'], 1.99)
        @slow_pace_data = PaceData.new(GoldenPaces.slow[:'14:00'], GoldenPaces.slow[:'42:00'], 1.35)
      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': '04:17', '15:00': '04:33', '20:00': '05:53', '25:00': '07:09', '30:00': '08:23', '35:00': '09:33', '40:00': '10:41', '42:00': '11:08' }
        end

        def self.slow
          { '14:00': '05:01', '15:00': '05:20', '20:00': '06:51', '25:00': '08:17', '30:00': '09:38', '35:00': '10:56', '40:00': '12:10', '42:00': '12:39' }
        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/easy_run.rb
runby_pace-0.6.90 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.6.89 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.6.88 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.6.87 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.5.86 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.5.85 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.4.84 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.4.83 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.4.82 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.4.81 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.4.79 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.4.78 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.4.77 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.3.76 lib/runby_pace/run_types/easy_run.rb
runby_pace-0.2.75 lib/runby_pace/run_types/easy_run.rb