Sha256: 10d5e18b06b0c408a2cc4803278b049f2cad2e7ebdb70ae70e837defef5642cb

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

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

    def 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("RunbyPace::RunTypes::#{run_type_name}").new
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
runby_pace-0.2.74 lib/runby_pace/run_type.rb
runby_pace-0.2.73 lib/runby_pace/run_type.rb