Class: Burner::Library::Value::Transform
- Inherits:
-
JobWithRegister
- Object
- Job
- JobWithRegister
- Burner::Library::Value::Transform
- Defined in:
- lib/burner/library/value/transform.rb
Overview
Transform the current value of the register through a Realize::Pipeline. This will transform the entire value, as opposed to the b/collection/transform job, which will iterate over each row/record in a dataset and transform each row/record.
Constant Summary
Constants inherited from JobWithRegister
Instance Attribute Summary collapse
-
#pipeline ⇒ Object
readonly
Returns the value of attribute pipeline.
Attributes inherited from JobWithRegister
Attributes inherited from Job
Instance Method Summary collapse
-
#initialize(name: '', register: DEFAULT_REGISTER, separator: '', transformers: []) ⇒ Transform
constructor
A new instance of Transform.
- #perform(_output, payload) ⇒ Object
Methods included from Util::Arrayable
Constructor Details
#initialize(name: '', register: DEFAULT_REGISTER, separator: '', transformers: []) ⇒ Transform
Returns a new instance of Transform.
22 23 24 25 26 27 28 29 30 |
# File 'lib/burner/library/value/transform.rb', line 22 def initialize(name: '', register: DEFAULT_REGISTER, separator: '', transformers: []) super(name: name, register: register) resolver = Objectable.resolver(separator: separator) @pipeline = Realize::Pipeline.new(transformers, resolver: resolver) freeze end |
Instance Attribute Details
#pipeline ⇒ Object (readonly)
Returns the value of attribute pipeline.
20 21 22 |
# File 'lib/burner/library/value/transform.rb', line 20 def pipeline @pipeline end |
Instance Method Details
#perform(_output, payload) ⇒ Object
32 33 34 |
# File 'lib/burner/library/value/transform.rb', line 32 def perform(_output, payload) payload[register] = pipeline.transform(payload[register], payload.time) end |