Class: Rspreadsheet::WorksheetCells
- Inherits:
-
Object
- Object
- Rspreadsheet::WorksheetCells
- Defined in:
- lib/rspreadsheet/worksheet.rb
Overview
this allows the sheet.cells syntax this object is result of sheet.cells
Instance Method Summary collapse
- #[](r, c) ⇒ Object
-
#cells_object(r, c) ⇒ Object
internal.
-
#initialize ⇒ WorksheetCells
constructor
A new instance of WorksheetCells.
- #initialize_cell(r, c, source_node) ⇒ Object
- #nonemptycells ⇒ Object
Constructor Details
#initialize ⇒ WorksheetCells
Returns a new instance of WorksheetCells.
77 78 79 80 81 82 83 |
# File 'lib/rspreadsheet/worksheet.rb', line 77 def initialize @cells = Hash.new do |hash, coords| # we create empty cell and place it to hash, we do not have to check whether there is a cell in XML already, because it would be in hash as well hash[coords]=Cell.new(coords[0],coords[1]) # TODO: create XML empty node here or upon save? end end |
Instance Method Details
#[](r, c) ⇒ Object
84 85 86 |
# File 'lib/rspreadsheet/worksheet.rb', line 84 def [](r,c) cells_object(r,c) end |
#cells_object(r, c) ⇒ Object
internal
92 93 94 |
# File 'lib/rspreadsheet/worksheet.rb', line 92 def cells_object(r,c) @cells[[r,c]] end |
#initialize_cell(r, c, source_node) ⇒ Object
95 96 97 |
# File 'lib/rspreadsheet/worksheet.rb', line 95 def initialize_cell(r,c,source_node) @cells[[r,c]]=Cell.new(r,c,source_node) end |
#nonemptycells ⇒ Object
87 88 89 |
# File 'lib/rspreadsheet/worksheet.rb', line 87 def nonemptycells @cells.values end |