class Representable::Collect

Collect applies a pipeline to each element of input.

Public Instance Methods

call(input, options) click to toggle source

when stop, the element is skipped. (should that be Skip then?)

Calls superclass method Representable::Pipeline#call
# File lib/representable/pipeline.rb, line 36
def call(input, options)
  arr = []
  input.each_with_index do |item_fragment, i|
    result = super(item_fragment, options.merge(index: i)) # DISCUSS: NO :fragment set.
    Pipeline::Stop == result ? next : arr << result
  end
  arr
end