lib/dry/system/config/namespace.rb in dry-system-0.21.0 vs lib/dry/system/config/namespace.rb in dry-system-0.22.0
- old
+ new
@@ -19,20 +19,23 @@
#
# Namespaces are added and configured for a component dir via {Namespaces#add}.
#
# @see Namespaces#add
#
- # @api private
+ # @api public
class Namespace
ROOT_PATH = nil
include Dry::Equalizer(:path, :key, :const)
+ # @api public
attr_reader :path
+ # @api public
attr_reader :key
+ # @api public
attr_reader :const
# 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
@@ -46,23 +49,27 @@
key: nil,
const: nil
)
end
+ # @api private
def initialize(path:, key:, const:)
@path = path
@key = key
@const = const
end
+ # @api public
def root?
path == ROOT_PATH
end
+ # @api public
def path?
!root?
end
+ # @api private
def default_key?
key == path
end
end
end