Sha256: 2f6d7f8963643d720fa70433b9d4720676b8e4451b5920806b24d666f56c8bee

Contents?: true

Size: 673 Bytes

Versions: 23

Compression:

Stored size: 673 Bytes

Contents

# frozen_string_literal: true

module Runby
  # Base class for all run types
  class RunType
    def description
      'No description'
    end

    def explanation
      'No explanation'
    end

    def lookup_pace(five_k_time, distance_units = :km) end
  end

  # Extends RunTypes with additional methods.
  # Since RunTypes is autogenerated in all_run_types.g.rb, we needed a safe way of adding behavior to it
  #  without complicating the codegen.
  module RunTypes
    # Returns an initialized run type, given the name of an existing run type
    def self.new_from_name(run_type_name)
      Object.const_get("Runby::RunTypes::#{run_type_name}").new
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
runby_pace-0.62.7 lib/runby_pace/run_type.rb
runby_pace-0.62.5 lib/runby_pace/run_type.rb
runby_pace-0.62.4 lib/runby_pace/run_type.rb
runby_pace-0.62.3 lib/runby_pace/run_type.rb
runby_pace-0.62.2 lib/runby_pace/run_type.rb
runby_pace-0.2.50.111 lib/runby_pace/run_type.rb
runby_pace-0.61.160 lib/runby_pace/run_type.rb
runby_pace-0.61.159 lib/runby_pace/run_type.rb
runby_pace-0.61.158 lib/runby_pace/run_type.rb
runby_pace-0.61.157 lib/runby_pace/run_type.rb
runby_pace-0.61.156 lib/runby_pace/run_type.rb
runby_pace-0.61.155 lib/runby_pace/run_type.rb
runby_pace-0.61.154 lib/runby_pace/run_type.rb
runby_pace-0.61.153 lib/runby_pace/run_type.rb
runby_pace-0.6.152 lib/runby_pace/run_type.rb
runby_pace-0.6.151 lib/runby_pace/run_type.rb
runby_pace-0.6.150 lib/runby_pace/run_type.rb
runby_pace-0.6.149 lib/runby_pace/run_type.rb
runby_pace-0.6.148 lib/runby_pace/run_type.rb
runby_pace-0.6.147 lib/runby_pace/run_type.rb