--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: Create a new namespace within the container, with the given name. If a block is provided, it will be invoked when the namespace is created, with the new namespace passed to it.
- !ruby/struct:SM::Flow::P 
  body: "For the curious, namespaces are simply services that are implemented by Container. The two statements are conceptually identical:"
- !ruby/struct:SM::Flow::VERB 
  body: "  container.namespace( :calc )\n  container.register( :calc ) { |c,p| Needle::Container.new( c, p.name ) }\n"
- !ruby/struct:SM::Flow::P 
  body: Note that this means that namespaces may be singletons or prototypes, or have immediate or deferred instantiation, and so forth. (The default of immediate, singleton instantiation is sufficient for 99% of the things you'll use namespaces for.)
- !ruby/struct:SM::Flow::P 
  body: "Usage:"
- !ruby/struct:SM::Flow::VERB 
  body: "  container.namespace( :operations ) do |op|\n    op.register( :add ) { Adder.new }\n    ...\n  end\n\n  adder = container.calc.operations.add\n"
- !ruby/struct:SM::Flow::P 
  body: "<b>Note</b>: the block is not invoked until the namespace is created, which is not until it is first referenced. If you need the namespace to be created immediately, either use #namespace_define or reference the namespace as soon as you've created it."
full_name: Needle::Container#namespace
is_singleton: false
name: namespace
params: ( name, opts={}, &block )
visibility: public
