Class: Dry::Container::NamespaceDSL Private
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Dry::Container::NamespaceDSL
- Defined in:
- lib/dry/container/namespace_dsl.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #import(namespace) ⇒ Object private
-
#initialize(container, namespace, namespace_separator) { ... } ⇒ Mixed
constructor
private
DSL for defining namespaces.
- #namespace(namespace, &block) ⇒ Object private
- #register(key, *args, &block) ⇒ Object private
- #resolve(key) ⇒ Object private
Constructor Details
#initialize(container, namespace, namespace_separator) { ... } ⇒ Mixed
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
DSL for defining namespaces
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/dry/container/namespace_dsl.rb', line 21 def initialize(container, namespace, namespace_separator, &block) @namespace = namespace @namespace_separator = namespace_separator super(container) if block.arity.zero? instance_eval(&block) else yield self end end |
Instance Method Details
#import(namespace) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 45 46 |
# File 'lib/dry/container/namespace_dsl.rb', line 42 def import(namespace) namespace(namespace.name, &namespace.block) self end |
#namespace(namespace, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 |
# File 'lib/dry/container/namespace_dsl.rb', line 38 def namespace(namespace, &block) super(namespaced(namespace), &block) end |
#register(key, *args, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/dry/container/namespace_dsl.rb', line 34 def register(key, *args, &block) super(namespaced(key), *args, &block) end |
#resolve(key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
48 49 50 |
# File 'lib/dry/container/namespace_dsl.rb', line 48 def resolve(key) super(namespaced(key)) end |