A single element in an interceptor chain. Each interceptor object is wrapped in an instance of one of these. Calling process_next on a given chain element, invokes the process method on the corresponding interceptor, with the next element in the chain being passed in.
Methods
Public Class methods
Create a new InterceptorChainElement that wraps the given interceptor.
[ show source ]
# File lib/needle/interceptor-chain.rb, line 40
40: def initialize( interceptor )
41: @interceptor = interceptor
42: end
Public Instance methods
Set the next element in the interceptor chain to the given object. This must be either an InterceptorChainElement instance of a ProxyObjectChainElement instance.
[ show source ]
# File lib/needle/interceptor-chain.rb, line 47
47: def next=( next_obj )
48: @next_obj = next_obj
49: end
Invokes the process method of the interceptor encapsulated by this object, with the next element in the chain being passed to it.
[ show source ]
# File lib/needle/interceptor-chain.rb, line 53
53: def process_next( context )
54: if @next_obj.nil?
55: raise Bug,
56: "[BUG] interceptor chain should always terminate with proxy"
57: end
58: @interceptor.process( @next_obj, context )
59: end