Class: Importer::Parser::Csv
Overview
CSV parser
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
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/importer/parser/csv.rb', line 7 def run @data = [] data = CSV.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 |