Class: Needle::Lifecycle::Initialize

### Home Classes Methods

### In Files

- lib/needle/lifecycle/initialize.rb

### Parent

Needle::Pipeline::Element

### Methods

- #call
- #initialize_element

### 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::Lifecycle::Initialize

The instantiation pipeline element that implements calling a separate initialization method on the instantiated service. This should always be placed in the pipeline as close to the service implementation as possible (hence, the low default priority).

### Public Instance Methods

call( *args ) click to toggle source

Invokes the next element of the chain. If the result responds to the requested initialization method, that method is invoked on the result, and the result is returned.

    # File lib/needle/lifecycle/initialize.rb, line 40
    def call( *args )
      service = succ.call( *args )
      service.send @init_method if service.respond_to?( @init_method )
      service
    end

initialize_element() click to toggle source

Initialize the element. Looks at the options hash to determine the name of the initialization method to call, defaulting to `:initialize_service`.

    # File lib/needle/lifecycle/initialize.rb, line 33
    def initialize_element
      @init_method = options[:init_method] || :initialize_service
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.