class Condition::Reader::RooReader
Public Instance Methods
read(ss)
click to toggle source
# File lib/condition/reader/roo_reader.rb, line 13 def read(ss) 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
read_row(ss, row_index)
click to toggle source
# File lib/condition/reader/roo_reader.rb, line 30 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)
click to toggle source
# 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] read(ss) end