Class: Saxlsx::RowsCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/saxlsx/rows_collection.rb

Instance Method Summary collapse

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

#countObject 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