Module: MinDI::InjectableContainer

Includes:
Injectable
Defined in:
lib/mindi.rb

Overview

An InjectableContainer “injects” itself into the services, so that they can all refer to each other.

Including this module has the combined effect of making the class act as a container (by extend-ing it with Container) and making the class Injectable (by include-ing Injectable). Additionally, including this module defines two class methods #injected and #uninjected, which determine whether subsequently defined services have the container injected into them. (The default is #injected.)

Also, the module defines an #inspect method, so that inspecting injected objects doesn’t dump the entire container and all of its services.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Injectable

#inject_into, #method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MinDI::Injectable

Class Method Details

.included(mod) ⇒ Object

:nodoc:



373
374
375
376
377
# File 'lib/mindi.rb', line 373

def self.included mod # :nodoc:
  mod.extend Container
  mod.extend InjectableContainer::ClassMethods
  mod.injected
end

Instance Method Details

#inspectObject

:nodoc:



379
380
381
# File 'lib/mindi.rb', line 379

def inspect # :nodoc:
  "<#{self.class}:0x%0x>" % object_id
end