Class: Pipetree::Railway::On

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

Overview

Incoming direction must be Left/Right. Tie

Instance Method Summary collapse

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, options)
  return [last, input] unless last == @track # return unless incoming track is Right (or Left).
  @proc.(last, input, options)
end