Method: Spreadsheet::Worksheet#each
- Defined in:
- lib/spreadsheet/worksheet.rb
#each(skip = , &block) ⇒ Object
If no argument is given, #each iterates over all used Rows (from the first used Row until but omitting the first unused Row, see also #dimensions).
If the argument skip is given, #each iterates from that row until but omitting the first unused Row, effectively skipping the first skip Rows from the top of the Worksheet.
169 170 171 172 173 174 175 176 177 |
# File 'lib/spreadsheet/worksheet.rb', line 169 def each(skip = dimensions[0], &block) rows = skip.upto(dimensions[1] - 1).map { |index| row(index) }.to_enum if block_given? rows.each(&block) else rows end end |