Class: Pipetree::Flow::On

Inherits:
Object
  • Object
show all
Defined in:
lib/pipetree/flow.rb

Overview

Incoming direction must be Left/Right.

Instance Method Summary collapse

Constructor Details

#initialize(direction, proc) ⇒ On

Returns a new instance of On.



80
81
82
# File 'lib/pipetree/flow.rb', line 80

def initialize(direction, proc)
  @direction, @proc = direction, proc
end

Instance Method Details

#call(last, input, options) ⇒ Object



84
85
86
87
# File 'lib/pipetree/flow.rb', line 84

def call(last, input, options)
  return [last, input] unless last == @direction # return unless incoming direction is Right (or Left).
  @proc.(last, input, options)
end