Module: Needle

Defined in:
lib/needle/extras.rb,
lib/needle/extras/version.rb,
lib/needle/extras/multicast.rb,
lib/needle/extras/attr-inject.rb,
lib/needle/extras/require-library.rb

Defined Under Namespace

Modules: Extras Classes: Container

Constant Summary collapse

LIBRARIES =

This constant represents the collection of registered libraries. Each value in it must respond to the #call method, accepting a single parameter (the container to register the library with).

Hash.new

Class Method Summary collapse

Class Method Details

.register_library(name, mod, registration_method = :register_services) ⇒ Object

A convenience method for registering libraries with the “require-library” subsystem. name must correspond to a file to require with Kernel.require. mod is a module containing the registration method named by the registration_method parameter (defaulting to :register_library).



27
28
29
30
31
# File 'lib/needle/extras/require-library.rb', line 27

def register_library( name, mod, registration_method=:register_services )
  LIBRARIES[ name ] = lambda do |container|
    mod.__send__( registration_method, container )
  end
end