Sha256: ab9eaaf39be554082d2989cc326fc862b30c959143959a99a414f85c6f607c16

Contents?: true

Size: 836 Bytes

Versions: 1

Compression:

Stored size: 836 Bytes

Contents

Creating a registry is as simple as calling @Needle::Registry.new@. This will give you a new registry object, bootstrapped to contain a few general services.

<pre>
  require 'needle'

  registry = Needle::Registry.new
</pre>

Once you have the reference to the registry, you can register services with it, create new namespaces in it, and so forth.

Alternatively, you can pass a block to @#new@:

<pre>
  registry = Needle::Registry.new do |r|
    ...
  end
</pre>

The parameter to the block will be a reference to the registry. This allows you to register services with the registry as soon as it is created.

One other convenience method is @#new!@:

<pre>
  registry = Needle::Registry.new! do
    ...
  end
</pre>

This block accepts no parameters, and evaluates the block as if it were passed to @Registry#define!@ (see below).

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
needle-0.6.0 doc/manual/parts/02_creating.txt