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).
Methods
Public Instance methods
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.
[ show source ]
# File lib/needle/lifecycle/initialize.rb, line 40 40: def call( *args ) 41: service = succ.call( *args ) 42: service.send @init_method if service.respond_to?( @init_method ) 43: service 44: end
Initialize the element. Looks at the options hash to determine the name of the initialization method to call, defaulting to :initialize_service.
[ show source ]
# File lib/needle/lifecycle/initialize.rb, line 33 33: def initialize_element 34: @init_method = options[:init_method] || :initialize_service 35: end