class DataFile::Reader::Excel

Public Instance Methods

headers() click to toggle source
# File lib/data_file/reader/excel.rb, line 10
def headers
  defined?(POI) ? rows[0].cells.map(&:value) : rows[0].to_a
end
operator() click to toggle source
# File lib/data_file/reader/excel.rb, line 26
def operator
  defined?(POI) ? POI::Workbook : Spreadsheet
end
rows() click to toggle source
# File lib/data_file/reader/excel.rb, line 14
def rows
  worksheet.rows
end
rows_index() click to toggle source
# File lib/data_file/reader/excel.rb, line 22
def rows_index
  reader.options[:headers] ? 1 : 0
end
rows_range() click to toggle source
# File lib/data_file/reader/excel.rb, line 18
def rows_range
  (rows_index..rows.size)
end

Private Instance Methods

excel() click to toggle source
# File lib/data_file/reader/excel.rb, line 31
def excel
  operator.open(reader.file_path)
end
worksheet() click to toggle source
# File lib/data_file/reader/excel.rb, line 35
def worksheet
  excel.worksheets.first
end