Class: Representable::Pipeline

Inherits:
Array
  • Object
show all
Extended by:
Macros
Defined in:
lib/representable/insert.rb,
lib/representable/pipeline.rb

Overview

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

Direct Known Subclasses

Collect, Collect::Hash

Defined Under Namespace

Modules: Debug, Function, Macros

Constant Summary collapse

Insert =
Pipeline::Function::Insert.new
Stop =
Class.new

Instance Method Summary collapse

Methods included from Macros

insert

Instance Method Details

#call(input, options) ⇒ Object

options is mutable.



8
9
10
11
12
13
14
15
# 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