Class: Burner::Library::Collection::OnlyKeys
- Inherits:
-
JobWithDynamicKeys
- Object
- Job
- JobWithRegister
- JobWithDynamicKeys
- Burner::Library::Collection::OnlyKeys
- Defined in:
- lib/burner/library/collection/only_keys.rb
Overview
This job knows how to take an array of objects and limit it to a specific set of keys. The keys are pulled from another register which helps make it dynamic (you can load up this other register with a dynamic list of keys at run-time.)
Expected Payload input: array of objects. Payload output: An array of objects.
Constant Summary
Constants inherited from JobWithRegister
Instance Attribute Summary
Attributes inherited from JobWithDynamicKeys
Attributes inherited from JobWithRegister
Attributes inherited from Job
Instance Method Summary collapse
Methods inherited from JobWithDynamicKeys
Methods inherited from JobWithRegister
Methods inherited from Job
Methods included from Util::Arrayable
Constructor Details
This class inherits a constructor from Burner::JobWithDynamicKeys
Instance Method Details
#perform(output, payload) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/burner/library/collection/only_keys.rb', line 20 def perform(output, payload) objects = array(payload[register]) count = objects.length keys = array(payload[keys_register]) output.detail("Dynamically limiting #{count} object(s) with key(s): #{keys.join(', ')}") payload[register] = objects.map { |object| transform(object, keys) } end |