Method: Needle::Container#method_missing

Defined in:
lib/needle/container.rb

#method_missing(sym, *args) ⇒ Object

As a convenience for accessing services, this delegates any message sent to the container (which has no parameters and no block) to Container#[]. Note that this incurs slightly more overhead than simply calling Container#[] directly, so if performance is an issue, you should avoid this approach.

Usage:

container.register( :add ) { Adder.new }
p container.add == container[:add] # => true


378
379
380
381
382
383
384
# File 'lib/needle/container.rb', line 378

def method_missing( sym, *args )
  if knows_key?( sym )
    get( sym, *args )
  else
    super
  end
end