Sha256: 803daa3eed30f45bd6e311de047e39181fadd55ba10ce89d77b409e8e764e802

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

module Dyno
  class Competitor
    attr_accessor :name, :uid, :position, :vehicle, :laps, :race_time,
      :best_lap, :lap_times

    ##
    # @param [String] name The competitor's name.
    # @param [Hash]   properties Extra information about the competitor.
    #
    def initialize(name, properties = {})
      @name = name
      @lap_times = properties.fetch(:laps, [])

      [:uid, :position, :vehicle, :laps, :race_time, :best_lap].each do |prop|
        instance_variable_set "@#{prop}", properties[prop]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
anthonyw-dyno-0.0.3 lib/dyno/competitor.rb