Class: Pipetree::Flow::On
- Inherits:
-
Object
- Object
- Pipetree::Flow::On
- Defined in:
- lib/pipetree/flow.rb
Overview
Incoming direction must be Left/Right.
Instance Method Summary collapse
- #call(last, input, options) ⇒ Object
-
#initialize(direction, proc) ⇒ On
constructor
A new instance of On.
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, ) return [last, input] unless last == @direction # return unless incoming direction is Right (or Left). @proc.(last, input, ) end |