class DataFile::Reader::CSV
Public Instance Methods
headers()
click to toggle source
# File lib/data_file/reader/csv.rb, line 6 def headers @headers ||= (csv.headers rescue nil) || [] end
rows()
click to toggle source
# File lib/data_file/reader/csv.rb, line 10 def rows @rows ||= csv.each_with_object([]) do |row, array| array << (row.is_a?(::CSV::Row) ? row.to_hash.values : row) end end
Private Instance Methods
csv()
click to toggle source
# File lib/data_file/reader/csv.rb, line 17 def csv @csv ||= ::CSV.parse(reader.file.read, reader.options) end