Sha256: a0f0a39d7d44dcdeaeabe68f3e0a5b54cc7bf50533d213ffea1a3928df9217d0

Contents?: true

Size: 587 Bytes

Versions: 16

Compression:

Stored size: 587 Bytes

Contents

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
runby_pace-0.6.91 lib/runby_pace/run_type.rb
runby_pace-0.6.90 lib/runby_pace/run_type.rb
runby_pace-0.6.89 lib/runby_pace/run_type.rb
runby_pace-0.6.88 lib/runby_pace/run_type.rb
runby_pace-0.6.87 lib/runby_pace/run_type.rb
runby_pace-0.5.86 lib/runby_pace/run_type.rb
runby_pace-0.5.85 lib/runby_pace/run_type.rb
runby_pace-0.4.84 lib/runby_pace/run_type.rb
runby_pace-0.4.83 lib/runby_pace/run_type.rb
runby_pace-0.4.82 lib/runby_pace/run_type.rb
runby_pace-0.4.81 lib/runby_pace/run_type.rb
runby_pace-0.4.79 lib/runby_pace/run_type.rb
runby_pace-0.4.78 lib/runby_pace/run_type.rb
runby_pace-0.4.77 lib/runby_pace/run_type.rb
runby_pace-0.3.76 lib/runby_pace/run_type.rb
runby_pace-0.2.75 lib/runby_pace/run_type.rb