Class: ReadExcel::XLSReader::Worksheet
- Inherits:
-
Object
- Object
- ReadExcel::XLSReader::Worksheet
- Defined in:
- lib/read_excel/xls_reader.rb
Instance Method Summary collapse
-
#initialize(worksheet) ⇒ Worksheet
constructor
A new instance of Worksheet.
- #name ⇒ Object
- #row(n) ⇒ Object
Constructor Details
#initialize(worksheet) ⇒ Worksheet
Returns a new instance of Worksheet.
6 7 8 |
# File 'lib/read_excel/xls_reader.rb', line 6 def initialize(worksheet) @worksheet = worksheet end |
Instance Method Details
#name ⇒ Object
10 11 12 |
# File 'lib/read_excel/xls_reader.rb', line 10 def name @worksheet.name end |
#row(n) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/read_excel/xls_reader.rb', line 14 def row(n) values = [] if @worksheet.row(n) count = @worksheet.row(n).size (0...count).each do |col| cell = @worksheet.row(n)[col] if cell.class == Spreadsheet::Formula values << cell.value else values << cell end end end values end |