For developers of service libraries, RequireLibrary provides a hook for registering their libraries with Needle:

<pre>
  module Foo
    module Bar

      def register_services( container )
        ...
      end
      module_function :register_services

      if defined?(Needle.register_library)
        Needle.register_library( 'foo/bar', self )
      end

    end
  end
</pre>

The @#register_services@ method is Needle's standard callback for registering a library's services with the given container.

The next lines, though, check to see if @Needle.register_library@ is defined. This allows the library to be used even when Needle-Extras is not loaded, or even installed. If the method exists, it is invoked with the @require@ path of the file, and the module reference that contains the @#register_services@ method.

Then, consumers of the library can load it using RequireLibrary as follows:

<pre>
  require 'needle'

  reg = Needle::Registry.new
  reg.require_library 'foo/bar'
  ...
</pre>

The call to @Container#require_library@ invokes @Kernel#require@, and then looks to see if there is a hook registered for the @'foo/bar'@ path. If there is, the hook is invoked, which (by default) invokes the @#register_services@ method, passing the current container as the parameter.
