Class: Realize::Pipeline
- Inherits:
-
Object
- Object
- Realize::Pipeline
- Defined in:
- lib/realize/pipeline.rb
Overview
Main runner that encapsulates a collection of transformers and knows how to kick off the transformation process.
Instance Attribute Summary collapse
-
#resolver ⇒ Object
readonly
Returns the value of attribute resolver.
-
#transformers ⇒ Object
readonly
Returns the value of attribute transformers.
Instance Method Summary collapse
-
#initialize(transformers = [], resolver: Objectable.resolver) ⇒ Pipeline
constructor
A new instance of Pipeline.
- #transform(record, time = Time.now.utc) ⇒ Object
Constructor Details
#initialize(transformers = [], resolver: Objectable.resolver) ⇒ Pipeline
Returns a new instance of Pipeline.
16 17 18 19 20 21 22 23 |
# File 'lib/realize/pipeline.rb', line 16 def initialize(transformers = [], resolver: Objectable.resolver) raise ArgumentError, 'resolver is required' unless resolver @resolver = resolver @transformers = Transformers.array(transformers) freeze end |
Instance Attribute Details
#resolver ⇒ Object (readonly)
Returns the value of attribute resolver.
14 15 16 |
# File 'lib/realize/pipeline.rb', line 14 def resolver @resolver end |
#transformers ⇒ Object (readonly)
Returns the value of attribute transformers.
14 15 16 |
# File 'lib/realize/pipeline.rb', line 14 def transformers @transformers end |
Instance Method Details
#transform(record, time = Time.now.utc) ⇒ Object
25 26 27 28 29 |
# File 'lib/realize/pipeline.rb', line 25 def transform(record, time = Time.now.utc) transformers.inject(record) do |memo, transformer| transformer.transform(resolver, memo, time, record) end end |