Class: DataImp::Parser::Csv
Instance Attribute Summary
#filename
Instance Method Summary
collapse
find_parser, #initialize, #process
Instance Method Details
#options ⇒ Object
3
4
5
|
# File 'lib/data_imp/parser/csv.rb', line 3
def options
{ headers: true }
end
|
#parse(chunk) ⇒ Object
7
8
9
|
# File 'lib/data_imp/parser/csv.rb', line 7
def parse chunk
chunk.to_h
end
|
#process_file(&block) ⇒ Object
11
12
13
14
15
|
# File 'lib/data_imp/parser/csv.rb', line 11
def process_file &block
CSV.open(filename, **options) do |csv|
process csv, &block
end
end
|