Method: Needle::Container#get
- Defined in:
- lib/needle/container.rb
#get(name, *args) ⇒ Object Also known as: []
Retrieves the named service, if it exists. Ancestors are searched if the service is not defined by the current container (see #find_definition). If the named service does not exist, ServiceNotFound is raised.
Note that this returns the instantiated service, not the service point.
Also, if any pipeline element in the instantiation pipeline does not support extra parameters when extra parameters have been given, then an error will be raised.
304 305 306 307 308 309 |
# File 'lib/needle/container.rb', line 304 def get( name, *args ) point = find_definition( name ) raise ServiceNotFound, "#{fullname}.#{name}" unless point point.instance( self, *args ) end |