class Dry::System::Config::Namespace

A configured namespace for a component dir

Namespaces consist of three elements:

Namespaces are added and configured for a component dir via {Namespaces#add}.

@see Namespaces#add

@api public

Constants

ROOT_PATH

Attributes

const[R]

@api public

key[R]

@api public

path[R]

@api public

Public Class Methods

default_root() click to toggle source

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
new(path:, key:, const:) click to toggle source

@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

default_key?() click to toggle source

@api private

# File lib/dry/system/config/namespace.rb, line 72
def default_key?
  key == path
end
path?() click to toggle source

@api public

# File lib/dry/system/config/namespace.rb, line 67
def path?
  !root?
end
root?() click to toggle source

@api public

# File lib/dry/system/config/namespace.rb, line 62
def root?
  path == ROOT_PATH
end