Class: Pipetree::Collect
Overview
Collect applies a pipeline to each element of input.
Direct Known Subclasses
Defined Under Namespace
Classes: Hash
Constant Summary
Constants inherited from Pipetree
Instance Method Summary collapse
-
#call(input, options) ⇒ Object
when stop, the element is skipped.
Methods included from Macros
Methods included from Inspect
#inspect, #inspect_func, #inspect_line, #inspect_object, #inspect_proc, #inspect_row, #inspect_rows
Instance Method Details
#call(input, options) ⇒ Object
when stop, the element is skipped. (should that be Skip then?)
36 37 38 39 40 41 42 43 |
# File 'lib/pipetree.rb', line 36 def call(input, ) arr = [] input.each_with_index do |item_fragment, i| result = super(item_fragment, .merge(index: i)) # DISCUSS: NO :fragment set. Stop == result ? next : arr << result end arr end |