Class: F1Results::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/f1results/result.rb

Direct Known Subclasses

QualifyingResult, RaceResult

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(row = nil) ⇒ Result

Returns a new instance of Result.



5
6
7
# File 'lib/f1results/result.rb', line 5

def initialize(row = nil)
  build(row) unless row.nil?
end

Instance Attribute Details

#driverObject

Returns the value of attribute driver.



3
4
5
# File 'lib/f1results/result.rb', line 3

def driver
  @driver
end

#driver_numberObject

Returns the value of attribute driver_number.



3
4
5
# File 'lib/f1results/result.rb', line 3

def driver_number
  @driver_number
end

#indexObject

Returns the value of attribute index.



3
4
5
# File 'lib/f1results/result.rb', line 3

def index
  @index
end

#lapsObject

Returns the value of attribute laps.



3
4
5
# File 'lib/f1results/result.rb', line 3

def laps
  @laps
end

#positionObject

Returns the value of attribute position.



3
4
5
# File 'lib/f1results/result.rb', line 3

def position
  @position
end

#retiredObject

Returns the value of attribute retired.



3
4
5
# File 'lib/f1results/result.rb', line 3

def retired
  @retired
end

#teamObject

Returns the value of attribute team.



3
4
5
# File 'lib/f1results/result.rb', line 3

def team
  @team
end

#timeObject

Returns the value of attribute time.



3
4
5
# File 'lib/f1results/result.rb', line 3

def time
  @time
end

Instance Method Details

#time_or_retiredObject



28
29
30
# File 'lib/f1results/result.rb', line 28

def time_or_retired
  time || retired
end

#time_or_retired=(str) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/f1results/result.rb', line 20

def time_or_retired=(str)
  if /^[0-9]|\+/ =~ str
    @time = str
  else
    @retired = str
  end
end