Class: Sudoku::Grid::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/sudoku/grid/cell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(grid, value) ⇒ Cell

Returns a new instance of Cell.



6
7
8
# File 'lib/sudoku/grid/cell.rb', line 6

def initialize(grid, value)
  @grid, @value = grid, value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/sudoku/grid/cell.rb', line 4

def value
  @value
end

Instance Method Details

#columnObject



14
15
16
# File 'lib/sudoku/grid/cell.rb', line 14

def column
  @grid.column(self)
end

#filled?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/sudoku/grid/cell.rb', line 10

def filled?
  !(@value.nil? || @value.zero?)
end

#rowObject



18
19
20
# File 'lib/sudoku/grid/cell.rb', line 18

def row
  @grid.row(self)
end