Sha256: dba4d6ca1ca6082d5a265146a48a69083616fbad1274e0334200768c1943d75a

Contents?: true

Size: 642 Bytes

Versions: 20

Compression:

Stored size: 642 Bytes

Contents

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

20 entries across 20 versions & 1 rubygems

Version Path
runby_pace-0.6.143 lib/runby_pace/run_type.rb
runby_pace-0.6.142 lib/runby_pace/run_type.rb
runby_pace-0.6.141 lib/runby_pace/run_type.rb
runby_pace-0.6.140 lib/runby_pace/run_type.rb
runby_pace-0.6.139 lib/runby_pace/run_type.rb
runby_pace-0.6.137 lib/runby_pace/run_type.rb
runby_pace-0.6.136 lib/runby_pace/run_type.rb
runby_pace-0.6.133 lib/runby_pace/run_type.rb
runby_pace-0.6.132 lib/runby_pace/run_type.rb
runby_pace-0.6.131 lib/runby_pace/run_type.rb
runby_pace-0.6.130 lib/runby_pace/run_type.rb
runby_pace-0.6.128 lib/runby_pace/run_type.rb
runby_pace-0.6.127 lib/runby_pace/run_type.rb
runby_pace-0.6.126 lib/runby_pace/run_type.rb
runby_pace-0.6.125 lib/runby_pace/run_type.rb
runby_pace-0.6.124 lib/runby_pace/run_type.rb
runby_pace-0.6.123 lib/runby_pace/run_type.rb
runby_pace-0.6.122 lib/runby_pace/run_type.rb
runby_pace-0.6.121 lib/runby_pace/run_type.rb
runby_pace-0.6.120 lib/runby_pace/run_type.rb