Class: Saxlsx::RowsCollection
- Inherits:
-
Object
- Object
- Saxlsx::RowsCollection
- Includes:
- Enumerable
- Defined in:
- lib/saxlsx/rows_collection.rb
Instance Method Summary collapse
- #[](value) ⇒ Object
- #count ⇒ Object (also: #size)
- #each(&block) ⇒ Object
-
#initialize(index, file_system, workbook) ⇒ RowsCollection
constructor
A new instance of RowsCollection.
Constructor Details
#initialize(index, file_system, workbook) ⇒ RowsCollection
Returns a new instance of RowsCollection.
6 7 8 9 10 11 |
# File 'lib/saxlsx/rows_collection.rb', line 6 def initialize(index, file_system, workbook) @index = index @file_system = file_system @workbook = workbook @sheet = file_system.sheet(index) end |
Instance Method Details
#[](value) ⇒ Object
23 24 25 |
# File 'lib/saxlsx/rows_collection.rb', line 23 def [](value) to_a[value] end |
#count ⇒ Object Also known as: size
17 18 19 |
# File 'lib/saxlsx/rows_collection.rb', line 17 def count @count ||= @sheet.match(/<dimension ref="[^:]+:[A-Z]*(\d+)"/)[1].to_i end |
#each(&block) ⇒ Object
13 14 15 |
# File 'lib/saxlsx/rows_collection.rb', line 13 def each(&block) RowsCollectionParser.parse @index, @sheet, @workbook, &block end |