Class: Needle::InterceptorChainBuilder::ProxyObjectChainElement

Inherits:
Object
  • Object
show all
Defined in:
lib/needle/interceptor-chain.rb

Overview

Encapsulates the end of an interceptor chain, which is the actual object being affected.

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ ProxyObjectChainElement

Create a new ProxyObjectChainElement that wraps the given object.



68
69
70
# File 'lib/needle/interceptor-chain.rb', line 68

def initialize( obj )
  @obj = obj
end

Instance Method Details

#process_next(context) ⇒ Object

Invoke the method represented by the context on the wrapped object.



73
74
75
# File 'lib/needle/interceptor-chain.rb', line 73

def process_next( context )
  @obj.__send__( context.sym, *context.args, &context.block )
end