class Dry::System::Config::Namespace
A configured namespace for a component dir
Namespaces
consist of three elements:
-
The `path` within the component dir to which its namespace rules should apply.
-
A `key`, which determines the leading part of the key used to register each component in the container.
-
A `const`, which is the Ruby namespace expected to contain the class constants defined within each component's source file. This value is expected to be an “underscored” string, intended to be run through the configured inflector to be converted into a real constant (e.g. `“foo_bar/baz”` will become `FooBar::Baz`)
Namespaces
are added and configured for a component dir via {Namespaces#add}.
@see Namespaces#add
@api public
Constants
- ROOT_PATH
Attributes
@api public
@api public
@api public
Public Class Methods
Returns a namespace configured to serve as the default root namespace for a component dir, ensuring that all code within the dir can be loaded, regardless of any other explictly configured namespaces
@return [Namespace] the root namespace
@api private
# File lib/dry/system/config/namespace.rb, line 46 def self.default_root new( path: ROOT_PATH, key: nil, const: nil ) end
@api private
# File lib/dry/system/config/namespace.rb, line 55 def initialize(path:, key:, const:) @path = path @key = key @const = const end
Public Instance Methods
@api private
# File lib/dry/system/config/namespace.rb, line 72 def default_key? key == path end
@api public
# File lib/dry/system/config/namespace.rb, line 67 def path? !root? end
@api public
# File lib/dry/system/config/namespace.rb, line 62 def root? path == ROOT_PATH end