Class: RedshiftETL::Extract::FileMaker

Inherits:
Object
  • Object
show all
Defined in:
lib/redshift_etl/extract/file_maker.rb

Overview

Extracts lines from the data source and puts the CSV files on S3.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ FileMaker

Returns a new instance of FileMaker.



10
11
12
13
14
# File 'lib/redshift_etl/extract/file_maker.rb', line 10

def initialize(config)
  @config     = config
  @file_index = 0
  @line_index = 0
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



9
10
11
# File 'lib/redshift_etl/extract/file_maker.rb', line 9

def config
  @config
end

Instance Method Details

#run(data_source) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/redshift_etl/extract/file_maker.rb', line 16

def run(data_source)
  new_file!
  data_source.lines do |line|
    process_line(line)
  end
  process_file!
end