Class: Excelerate::Worksheet
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Excelerate::Worksheet
- Extended by:
- ParentReader
- Defined in:
- lib/excelerate/worksheet.rb
Defined Under Namespace
Classes: Cell
Constant Summary collapse
- AS_CELL =
proc { |cell| Cell.new(:cell => cell) }
Instance Method Summary collapse
- #column(index) ⇒ Object
- #column_headers ⇒ Object
- #columns ⇒ Object
- #each_cell(&block) ⇒ Object
-
#initialize(options = {}) ⇒ Worksheet
constructor
A new instance of Worksheet.
- #row(index) ⇒ Object
- #rows ⇒ Object
Methods included from ParentReader
Constructor Details
#initialize(options = {}) ⇒ Worksheet
9 10 11 |
# File 'lib/excelerate/worksheet.rb', line 9 def initialize( = {}) __setobj__ [:worksheet] end |
Instance Method Details
#column(index) ⇒ Object
21 22 23 |
# File 'lib/excelerate/worksheet.rb', line 21 def column(index) columns[index] end |
#column_headers ⇒ Object
33 34 35 |
# File 'lib/excelerate/worksheet.rb', line 33 def column_headers rows.first.map(&AS_CELL) end |
#columns ⇒ Object
17 18 19 |
# File 'lib/excelerate/worksheet.rb', line 17 def columns cells.transpose.map { |c| c.map(&AS_CELL) } end |
#each_cell(&block) ⇒ Object
13 14 15 |
# File 'lib/excelerate/worksheet.rb', line 13 def each_cell(&block) cells.flatten.map(&AS_CELL).each &block end |
#row(index) ⇒ Object
29 30 31 |
# File 'lib/excelerate/worksheet.rb', line 29 def row(index) rows[index] end |
#rows ⇒ Object
25 26 27 |
# File 'lib/excelerate/worksheet.rb', line 25 def rows cells.map { |c| c.map(&AS_CELL) } end |