Class: DataFile::Reader::CSV
- Inherits:
-
Base
- Object
- Base
- DataFile::Reader::CSV
show all
- Defined in:
- lib/data_file/reader/csv.rb
Instance Attribute Summary
Attributes inherited from Base
#reader
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
6
7
8
|
# File 'lib/data_file/reader/csv.rb', line 6
def
@headers ||= (csv. rescue nil) || []
end
|
#rows ⇒ Object
10
11
12
13
14
|
# 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
|