Class: Sudoku::Grid::Cell
- Inherits:
-
Object
- Object
- Sudoku::Grid::Cell
- Defined in:
- lib/sudoku/grid/cell.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #column ⇒ Object
- #filled? ⇒ Boolean
-
#initialize(grid, value) ⇒ Cell
constructor
A new instance of Cell.
- #row ⇒ Object
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
#value ⇒ Object (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
#column ⇒ Object
14 15 16 |
# File 'lib/sudoku/grid/cell.rb', line 14 def column @grid.column(self) end |
#filled? ⇒ Boolean
10 11 12 |
# File 'lib/sudoku/grid/cell.rb', line 10 def filled? !(@value.nil? || @value.zero?) end |
#row ⇒ Object
18 19 20 |
# File 'lib/sudoku/grid/cell.rb', line 18 def row @grid.row(self) end |