Class: Pipetree

Inherits:
Array
  • Object
show all
Includes:
Inspect, Macros
Defined in:
lib/pipetree.rb,
lib/pipetree/flow.rb,
lib/pipetree/version.rb

Direct Known Subclasses

Collect

Defined Under Namespace

Modules: Function, Inspect, Macros Classes: Collect, Flow

Constant Summary collapse

Stop =

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

Class.new
Insert =
Pipetree::Function::Insert.new
VERSION =
"0.0.5"

Instance Method Summary collapse

Methods included from Macros

#insert!

Methods included from Inspect

#inspect, #inspect_func, #inspect_line, #inspect_object, #inspect_proc, #inspect_row, #inspect_rows

Instance Method Details

#call(input, options) ⇒ Object

options is mutuable. we have a fixed set of arguments here, since array splat significantly slows this down, as in call(input, *options)



9
10
11
12
13
14
15
# File 'lib/pipetree.rb', line 9

def call(input, options)
  inject(input) do |memo, step|
    res = evaluate(step, memo, options)
    return(Stop) if Stop == res
    res
  end
end