Class: POI::Rows
Instance Method Summary collapse
- #[](index) ⇒ Object
- #each ⇒ Object
-
#initialize(worksheet) ⇒ Rows
constructor
A new instance of Rows.
- #size ⇒ Object
Constructor Details
#initialize(worksheet) ⇒ Rows
Returns a new instance of Rows.
5 6 7 8 9 |
# File 'lib/poi/workbook/row.rb', line 5 def initialize(worksheet) @worksheet = worksheet @poi_worksheet = worksheet.poi_worksheet @rows = {} end |
Instance Method Details
#[](index) ⇒ Object
11 12 13 |
# File 'lib/poi/workbook/row.rb', line 11 def [](index) @rows[index] ||= Row.new(@poi_worksheet.get_row(index) || @poi_worksheet.create_row(index), @worksheet) end |
#each ⇒ Object
19 20 21 22 |
# File 'lib/poi/workbook/row.rb', line 19 def each it = @poi_worksheet.row_iterator yield Row.new(it.next, @worksheet) while it.has_next end |
#size ⇒ Object
15 16 17 |
# File 'lib/poi/workbook/row.rb', line 15 def size @poi_worksheet.physical_number_of_rows end |