Class: Pipetree::Railway::On
- Inherits:
-
Object
- Object
- Pipetree::Railway::On
- Defined in:
- lib/pipetree/railway.rb
Overview
Incoming direction must be Left/Right. Tie
Instance Method Summary collapse
- #call(last, input, options) ⇒ Object
-
#initialize(track, proc) ⇒ On
constructor
A new instance of On.
Constructor Details
#initialize(track, proc) ⇒ On
Returns a new instance of On.
61 62 63 |
# File 'lib/pipetree/railway.rb', line 61 def initialize(track, proc) @track, @proc = track, proc end |
Instance Method Details
#call(last, input, options) ⇒ Object
65 66 67 68 |
# File 'lib/pipetree/railway.rb', line 65 def call(last, input, ) return [last, input] unless last == @track # return unless incoming track is Right (or Left). @proc.(last, input, ) end |