Class: Condition::Reader::RooReader
- Inherits:
-
Object
- Object
- Condition::Reader::RooReader
- Defined in:
- lib/condition/reader/roo_reader.rb
Instance Method Summary collapse
Instance Method Details
#read_row(ss, row_index) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/condition/reader/roo_reader.rb', line 26 def read_row(ss, row_index) column_index = 1 result = [] while true value = ss.cell(row_index, column_index) return result if nil == value result << value column_index += 1 end end |
#read_sheet(path, sheet_index) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/condition/reader/roo_reader.rb', line 7 def read_sheet(path, sheet_index) ss = Roo::Spreadsheet.open(path) ss.default_sheet = ss.sheets[sheet_index] row_index = 1 res = [] while true break if nil == ss.cell(row_index, 1) table = [] while true row = read_row(ss, row_index) row_index += 1 break if 0 == row.size table << row end res << table end res end |