Class: ImportEverything::CsvParser

Inherits:
Parser show all
Defined in:
lib/import_everything/parsers/csv_parser.rb

Direct Known Subclasses

TableParser

Instance Method Summary collapse

Methods inherited from Parser

#each_row, #each_table_and_rows, #line_parsers, #table_rows_hash

Instance Method Details

#required_fieldsObject



12
13
14
# File 'lib/import_everything/parsers/csv_parser.rb', line 12

def required_fields
  []
end

#value_hashesObject



4
5
6
7
8
9
10
11
# File 'lib/import_everything/parsers/csv_parser.rb', line 4

def value_hashes
  require 'csv'
  res = []
  CSV.parse(str, :headers => true, :col_sep => delimiter) do |row|
    res << row.to_hash
  end
  res
end