Class: Importer::Parser::Csv
Overview
CSV parser Uses fastercsv lib to parse the CSV files.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Importer::Parser::Base
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/importer/parser/csv.rb', line 8 def run @data = [] data = FasterCSV.read(@file, :skip_blanks => true) unless data.empty? attributes = data.shift @data = data.map do |values| Hash[*attributes.zip(values).flatten] end end @data end |