Class: F1Results::Result
- Inherits:
-
Object
- Object
- F1Results::Result
- Defined in:
- lib/f1results/result.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#driver ⇒ Object
Returns the value of attribute driver.
-
#driver_number ⇒ Object
Returns the value of attribute driver_number.
-
#index ⇒ Object
Returns the value of attribute index.
-
#laps ⇒ Object
Returns the value of attribute laps.
-
#position ⇒ Object
Returns the value of attribute position.
-
#retired ⇒ Object
Returns the value of attribute retired.
-
#team ⇒ Object
Returns the value of attribute team.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(row = nil) ⇒ Result
constructor
A new instance of Result.
- #time_or_retired ⇒ Object
- #time_or_retired=(str) ⇒ Object
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
#driver ⇒ Object
Returns the value of attribute driver.
3 4 5 |
# File 'lib/f1results/result.rb', line 3 def driver @driver end |
#driver_number ⇒ Object
Returns the value of attribute driver_number.
3 4 5 |
# File 'lib/f1results/result.rb', line 3 def driver_number @driver_number end |
#index ⇒ Object
Returns the value of attribute index.
3 4 5 |
# File 'lib/f1results/result.rb', line 3 def index @index end |
#laps ⇒ Object
Returns the value of attribute laps.
3 4 5 |
# File 'lib/f1results/result.rb', line 3 def laps @laps end |
#position ⇒ Object
Returns the value of attribute position.
3 4 5 |
# File 'lib/f1results/result.rb', line 3 def position @position end |
#retired ⇒ Object
Returns the value of attribute retired.
3 4 5 |
# File 'lib/f1results/result.rb', line 3 def retired @retired end |
#team ⇒ Object
Returns the value of attribute team.
3 4 5 |
# File 'lib/f1results/result.rb', line 3 def team @team end |
#time ⇒ Object
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_retired ⇒ Object
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 |