Class: Setl::ETL

Inherits:
Object
  • Object
show all
Defined in:
lib/setl/etl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, destination, transform, stop_on_errors: false, error_handler: nil) ⇒ ETL

Returns a new instance of ETL.



5
6
7
8
9
10
11
12
# File 'lib/setl/etl.rb', line 5

def initialize(source, destination, transform, stop_on_errors: false, error_handler: nil)
  @stop_on_errors = stop_on_errors
  @error_handler = error_handler || DefaultHandler.new(stop_on_errors)

  @source = Source.new(source, @error_handler)
  @destination = Destination.new(destination, @error_handler)
  @transform = Transform.new(transform, @error_handler)
end

Instance Attribute Details

#last_rowObject (readonly)

Returns the value of attribute last_row.



22
23
24
# File 'lib/setl/etl.rb', line 22

def last_row
  @last_row
end

Instance Method Details

#processObject



14
15
16
17
18
19
20
# File 'lib/setl/etl.rb', line 14

def process
  source.each do |row|
    @last_row = row

    destination.(transform.(row))
  end
end