class Representable::Pipeline

Allows to implement a pipeline of filters where a value gets passed in and the result gets passed to the next callable object.

Constants

Insert
Stop

Public Instance Methods

call(input, options) click to toggle source

options is mutable.

# File lib/representable/pipeline.rb, line 8
def call(input, options)
  inject(input) do |memo, block|
    res = evaluate(block, memo, options)
    return(Stop) if Stop == res

    res
  end
end

Private Instance Methods

evaluate(block, input, options) click to toggle source
# File lib/representable/pipeline.rb, line 18
def evaluate(block, input, options)
  block.call(input, options)
end