Class: Setl::ETL
- Inherits:
-
Object
- Object
- Setl::ETL
- Defined in:
- lib/setl/etl.rb
Instance Attribute Summary collapse
-
#last_row ⇒ Object
readonly
Returns the value of attribute last_row.
Instance Method Summary collapse
-
#initialize(source, destination, stop_on_errors: false, error_handler: nil) ⇒ ETL
constructor
A new instance of ETL.
- #process(transform) ⇒ Object
Constructor Details
#initialize(source, destination, stop_on_errors: false, error_handler: nil) ⇒ ETL
Returns a new instance of ETL.
3 4 5 6 7 8 |
# File 'lib/setl/etl.rb', line 3 def initialize(source, destination, stop_on_errors: false, error_handler: nil) @source = source @destination = destination @stop_on_errors = stop_on_errors @error_handler = error_handler || DefaultHandler.new(stop_on_errors) end |
Instance Attribute Details
#last_row ⇒ Object (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
#process(transform) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/setl/etl.rb', line 10 def process(transform) source.each do |row| @last_row = row begin destination.(transform.(row)) rescue StandardError => e error_handler.(row, e) end end end |