### Home Classes Methods

### In Files

- lib/needle/interceptor-chain.rb

### Parent

Object

### Methods

- ::new
- #next
- #process_next

### Files

- README

### Class/Module Index

Quicksearch

- Needle
- Needle::Bug
- Needle::Container
- Needle::DefinitionContext
- Needle::IncludeExclude
- Needle::Interceptor
- Needle::Interceptor::DynamicInterceptor
- Needle::InterceptorChainBuilder
- Needle::InterceptorChainBuilder::InterceptedServiceProxy
- Needle::InterceptorChainBuilder::InterceptorChainElement
- Needle::InterceptorChainBuilder::ProxyObjectChainElement
- Needle::InterceptorConfigurationError
- Needle::Lifecycle
- Needle::Lifecycle::Deferred
- Needle::Lifecycle::Initialize
- Needle::Lifecycle::Multiton
- Needle::Lifecycle::Proxy
- Needle::Lifecycle::Singleton
- Needle::Lifecycle::Threaded
- Needle::LogFactory
- Needle::Logger
- Needle::LoggingInterceptor
- Needle::NeedleError
- Needle::Pipeline
- Needle::Pipeline::Collection
- Needle::Pipeline::Collection::BlockElement
- Needle::Pipeline::Element
- Needle::Pipeline::InterceptorElement
- Needle::QueryableMutex
- Needle::Registry
- Needle::ServiceNotFound
- Needle::ServicePoint
- Needle::Version

No matching classes.

# Needle::InterceptorChainBuilder::InterceptorChainElement

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.

### Public Class Methods

new( interceptor ) click to toggle source

Create a new InterceptorChainElement that wraps the given interceptor.

    # File lib/needle/interceptor-chain.rb, line 40
    def initialize( interceptor )
      @interceptor = interceptor
    end

### Public Instance Methods

next(=( next_obj )) click to toggle source

Set the next element in the interceptor chain to the given object. This must be either an InterceptorChainElement instance of a ProxyObjectChainElement instance.

    # File lib/needle/interceptor-chain.rb, line 47
    def next=( next_obj )
      @next_obj = next_obj
    end

process_next( context ) click to toggle source

Invokes the process method of the interceptor encapsulated by this object, with the next element in the chain being passed to it.

    # File lib/needle/interceptor-chain.rb, line 53
    def process_next( context )
      if @next_obj.nil?
        raise Bug,
          "[BUG] interceptor chain should always terminate with proxy"
      end
      @interceptor.process( @next_obj, context )
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.