class Dry::System::Config::ComponentDir
@api public
Attributes
path[R]
Returns the component dir path, relative to the configured container root
@return [String] the path
Public Class Methods
new(path) { |self| ... }
click to toggle source
@api public
Calls superclass method
# File lib/dry/system/config/component_dir.rb, line 195 def initialize(path) super() @path = path yield self if block_given? end
Public Instance Methods
auto_register?()
click to toggle source
@api private
# File lib/dry/system/config/component_dir.rb, line 202 def auto_register? !!config.auto_register end
configured?(key)
click to toggle source
Returns true if the given setting has been explicitly configured by the user
This is used when determining whether to apply system-wide default values to a component dir (explicitly configured settings will not be overridden by defaults)
@param key [Symbol] the setting name
@return [Boolean]
@see Dry::System::Config::ComponentDirs#apply_defaults_to_dir
@api private
# File lib/dry/system/config/component_dir.rb, line 218 def configured?(key) case key when :namespaces # Because we mutate the default value for the `namespaces` setting, rather # than assign a new one, to check if it's configured we must see whether any # namespaces have been added !config.namespaces.empty? else config._settings[key].input_defined? end end
default_namespace()
click to toggle source
@api public
# File lib/dry/system/config/component_dir.rb, line 172 def default_namespace Dry::Core::Deprecations.announce( "Dry::System::Config::ComponentDir#default_namespace", "Use namespaces instead, e.g. `dir.namespaces`", tag: "dry-system", uplevel: 1 ) ns_path = namespaces.to_a.reject(&:root?).first&.path # We don't have the configured separator here, so the best we can do is guess # that it's a dot ns_path&.gsub(PATH_SEPARATOR, ".") end
default_namespace=(namespace)
click to toggle source
@api public
# File lib/dry/system/config/component_dir.rb, line 154 def default_namespace=(namespace) Dry::Core::Deprecations.announce( "Dry::System::Config::ComponentDir#default_namespace=", "Add a namespace instead: `dir.namespaces.add #{namespace.to_s.inspect}, key: nil`", tag: "dry-system", uplevel: 1 ) # We don't have the configured separator here, so the best we can do is guess # that it's a dot namespace_path = namespace.gsub(".", PATH_SEPARATOR) return if namespaces.namespaces[namespace_path] namespaces.add namespace_path, key: nil end
Private Instance Methods
method_missing(name, *args, &block)
click to toggle source
Calls superclass method
# File lib/dry/system/config/component_dir.rb, line 232 def method_missing(name, *args, &block) if config.respond_to?(name) config.public_send(name, *args, &block) else super end end
respond_to_missing?(name, include_all = false)
click to toggle source
Calls superclass method
# File lib/dry/system/config/component_dir.rb, line 240 def respond_to_missing?(name, include_all = false) config.respond_to?(name) || super end