Class: POI::Cells

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/poi/workbook/cell.rb

Instance Method Summary collapse

Constructor Details

#initialize(row) ⇒ Cells

Returns a new instance of Cells.



5
6
7
8
9
# File 'lib/poi/workbook/cell.rb', line 5

def initialize(row)
  @row     = row
  @poi_row = row.poi_row
  @cells   = {}
end

Instance Method Details

#[](index) ⇒ Object



11
12
13
# File 'lib/poi/workbook/cell.rb', line 11

def [](index)
  @cells[index] ||= Cell.new(@poi_row.cell(index) || @poi_row.create_cell(index), @row)
end

#eachObject



19
20
21
22
# File 'lib/poi/workbook/cell.rb', line 19

def each
  it = @poi_row.cell_iterator
  yield Cell.new(it.next, @row) while it.has_next
end

#sizeObject



15
16
17
# File 'lib/poi/workbook/cell.rb', line 15

def size
  @poi_row.physical_number_of_cells
end