class C4::Model::Column
Attributes
max_size[R]
stones[R]
Public Class Methods
new(max_size)
click to toggle source
# File lib/c4/model/column.rb, line 13 def initialize(max_size) @stones = [] @max_size = max_size end
Public Instance Methods
full?()
click to toggle source
# File lib/c4/model/column.rb, line 24 def full? stones.size >= max_size end
put!(mark)
click to toggle source
# File lib/c4/model/column.rb, line 18 def put!(mark) raise ColumnFullError, 'This column is full!' if full? stones.push(mark) end
to_a()
click to toggle source
# File lib/c4/model/column.rb, line 28 def to_a stones.fill_up_to(max_size, nil) end