Class: LazierData::Processor::ChildEach
- Inherits:
-
Object
- Object
- LazierData::Processor::ChildEach
- Defined in:
- lib/lazier_data/processor/child_each.rb
Constant Summary collapse
- NOTHING =
:_lazier_data_nothing
Instance Attribute Summary collapse
-
#batch_size ⇒ Object
readonly
Returns the value of attribute batch_size.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#downstream ⇒ Object
readonly
Returns the value of attribute downstream.
-
#input_path ⇒ Object
readonly
Returns the value of attribute input_path.
-
#upstream ⇒ Object
readonly
Returns the value of attribute upstream.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(upstream, downstream, input_path, &block) ⇒ ChildEach
constructor
A new instance of ChildEach.
Constructor Details
#initialize(upstream, downstream, input_path, &block) ⇒ ChildEach
Returns a new instance of ChildEach.
10 11 12 13 14 15 16 |
# File 'lib/lazier_data/processor/child_each.rb', line 10 def initialize(upstream, downstream, input_path, &block) @upstream = upstream @downstream = downstream @batch_size = nil @input_path = input_path @block = block end |
Instance Attribute Details
#batch_size ⇒ Object (readonly)
Returns the value of attribute batch_size.
8 9 10 |
# File 'lib/lazier_data/processor/child_each.rb', line 8 def batch_size @batch_size end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
8 9 10 |
# File 'lib/lazier_data/processor/child_each.rb', line 8 def block @block end |
#downstream ⇒ Object (readonly)
Returns the value of attribute downstream.
8 9 10 |
# File 'lib/lazier_data/processor/child_each.rb', line 8 def downstream @downstream end |
#input_path ⇒ Object (readonly)
Returns the value of attribute input_path.
8 9 10 |
# File 'lib/lazier_data/processor/child_each.rb', line 8 def input_path @input_path end |
#upstream ⇒ Object (readonly)
Returns the value of attribute upstream.
8 9 10 |
# File 'lib/lazier_data/processor/child_each.rb', line 8 def upstream @upstream end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/lazier_data/processor/child_each.rb', line 18 def call upstream.each do |root_item, item_store| output_yielders = build_output_yielders(item_store) item_store.dig(*input_path).each do |item| block.call(item, *output_yielders) end downstream << [root_item, item_store] end end |