class Dry::Container::Namespace
Create a namespace to be imported
@example
ns = Dry::Container::Namespace.new('name') do register('item', 'item') end container = Dry::Container.new container.import(ns) container.resolve('name.item') => 'item'
@api public
Attributes
block[R]
@return [Proc] The block to be executed when the namespace is imported
name[R]
@return [Mixed] The namespace (name)
Public Class Methods
new(name, &block)
click to toggle source
Create a new namespace
@param [Mixed] name
The name of the namespace
@yield
The block to evaluate when the namespace is imported
@return [Dry::Container::Namespace]
@api public
# File lib/dry/container/namespace.rb, line 35 def initialize(name, &block) @name = name @block = block end