Class: Ductr::SequelBase::MatchLookup
- Inherits:
-
ETL::BufferedTransform
- Object
- ETL::Control
- ETL::Transform
- ETL::BufferedTransform
- Ductr::SequelBase::MatchLookup
- Defined in:
- lib/ductr/sequel_base/match_lookup.rb
Overview
A lookup control that execute the query for a bunch of rows and merge them with the buffer’s rows.
Instance Attribute Summary
Attributes inherited from ETL::BufferedTransform
Attributes inherited from ETL::Control
#adapter, #job_method, #options
Instance Method Summary collapse
-
#from_key ⇒ Symbol
The looked up row key to match.
-
#on_flush {|row| ... } ⇒ void
Opens the database if needed, calls the job’s method and merges the looked up rows with corresponding buffer rows.
-
#to_key ⇒ Symbol
The buffer row key to match.
Methods inherited from ETL::BufferedTransform
#buffer_size, #close, #flush_buffer, #process
Methods inherited from ETL::Transform
Methods inherited from ETL::Control
Constructor Details
This class inherits a constructor from Ductr::ETL::Control
Instance Method Details
#from_key ⇒ Symbol
The looked up row key to match.
14 15 16 |
# File 'lib/ductr/sequel_base/match_lookup.rb', line 14 def from_key @options[:merge].first end |
#on_flush {|row| ... } ⇒ void
This method returns an undefined value.
Opens the database if needed, calls the job’s method and merges the looked up rows with corresponding buffer rows.
36 37 38 39 40 41 42 43 |
# File 'lib/ductr/sequel_base/match_lookup.rb', line 36 def on_flush(&) call_method(adapter.db, buffer_keys).each do |row| match = buffer_find(row) next yield(row) unless match yield(row.merge match) end end |
#to_key ⇒ Symbol
The buffer row key to match.
23 24 25 |
# File 'lib/ductr/sequel_base/match_lookup.rb', line 23 def to_key @options[:merge].last end |