This is the wrapper for on-the-fly interceptors that have been created via Interceptor#doing. The callback registered with Interceptor#doing gets wrapped by an instance of this class, to comply with the interface required by InterceptorChainBuilder.

This class should rarely (if ever) be instantiated directly. Instead, using the Interceptor#doing method to create dynamic interceptors.

Methods
Public Class methods
new( callback )

Create a new DynamicInterceptor instance that wraps the given callback.

    # File lib/needle/interceptor.rb, line 48
48:       def initialize( callback )
49:         @callback = callback
50:       end
Public Instance methods
new( point, opts )

This method is a concession to the required interceptor factory interface. It should return the new interceptor, configured to be attached to the given service point, and with the given options. It will always return self.

    # File lib/needle/interceptor.rb, line 56
56:       def new( point, opts )
57:         @point = point
58:         @options = opts
59:         self
60:       end
process( chain, context )

Process this link in the interceptor chain. This will invoke the wrapped callback, passing in the chain and context parameters. Before invoking the callback, the options and service point references that were given in new are assigned to context data members (so they can be referenced inside the callback).

    # File lib/needle/interceptor.rb, line 67
67:       def process( chain, context )
68:         context.data[:options] = @options
69:         context.data[:point] = @point
70:         @callback.call( chain, context )
71:       end