Class: Ethel::Operation
- Inherits:
-
Object
- Object
- Ethel::Operation
- Defined in:
- lib/ethel/operation.rb
Direct Known Subclasses
Ethel::Operations::AddField, Ethel::Operations::Cast, Ethel::Operations::Copy
Instance Method Summary collapse
- #before_transform(source, target) ⇒ Object
-
#initialize(*args) ⇒ Operation
constructor
A new instance of Operation.
- #transform(row) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Operation
Returns a new instance of Operation.
3 4 5 |
# File 'lib/ethel/operation.rb', line 3 def initialize(*args) @child_operations = [] end |
Instance Method Details
#before_transform(source, target) ⇒ Object
7 8 9 10 11 |
# File 'lib/ethel/operation.rb', line 7 def before_transform(source, target) @child_operations.each do |child_operation| child_operation.before_transform(source, target) end end |
#transform(row) ⇒ Object
13 14 15 16 17 |
# File 'lib/ethel/operation.rb', line 13 def transform(row) @child_operations.inject(row) do |row, child_operation| child_operation.transform(row) end end |