Class: Chronicle::ETL::CSVExtractor
Instance Attribute Summary
#connector_registration
Instance Method Summary
collapse
#filenames, #pathnames, #read_from_files?, #read_from_stdin?, #read_input, #read_input_as_lines
Methods inherited from Extractor
#initialize
#register_connector
included
Instance Method Details
21
22
23
24
25
26
27
|
# File 'lib/chronicle/etl/extractors/csv_extractor.rb', line 21
def
@csvs.each do |csv|
csv.read.each do |row|
yield Chronicle::ETL::Extraction.new(data: row.to_h)
end
end
end
|
#prepare ⇒ Object
17
18
19
|
# File 'lib/chronicle/etl/extractors/csv_extractor.rb', line 17
def prepare
@csvs = prepare_sources
end
|
#results_count ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/chronicle/etl/extractors/csv_extractor.rb', line 29
def results_count
@csvs.reduce(0) do |total_rows, csv|
row_count = csv.readlines.size
csv.rewind
total_rows + row_count
end
end
|