Class: Kisaweb::ListItem
Instance Attribute Summary collapse
-
#points ⇒ Object
Returns the value of attribute points.
-
#position ⇒ Object
Returns the value of attribute position.
-
#runner ⇒ Object
Returns the value of attribute runner.
-
#runs ⇒ Object
Returns the value of attribute runs.
Class Method Summary collapse
Instance Attribute Details
#points ⇒ Object
Returns the value of attribute points.
3 4 5 |
# File 'lib/kisaweb/list_item.rb', line 3 def points @points end |
#position ⇒ Object
Returns the value of attribute position.
3 4 5 |
# File 'lib/kisaweb/list_item.rb', line 3 def position @position end |
#runner ⇒ Object
Returns the value of attribute runner.
3 4 5 |
# File 'lib/kisaweb/list_item.rb', line 3 def runner @runner end |
#runs ⇒ Object
Returns the value of attribute runs.
3 4 5 |
# File 'lib/kisaweb/list_item.rb', line 3 def runs @runs end |
Class Method Details
.from_array(arr) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/kisaweb/list_item.rb', line 5 def self.from_array(arr) item = new item.position = arr.first.to_i item.points = BigDecimal.new(arr.last) item.runner = Runner.new(*arr[1, 4]) item.runs = [] 5.step(13, 2) do |i| next unless arr[i] item.runs << Run.new(arr[i], arr[i + 1]) end item end |