lib/dry/system/config/component_dir.rb in dry-system-0.21.0 vs lib/dry/system/config/component_dir.rb in dry-system-0.22.0

- old
+ new

@@ -7,10 +7,11 @@ require_relative "namespaces" module Dry module System module Config + # @api public class ComponentDir include Dry::Configurable # @!group Settings @@ -35,18 +36,20 @@ # !component.identifier.start_with?("entities") # end # # @see auto_register # @see Component + # @api public # # @!method auto_register # # Returns the configured auto-registration policy. # # @return [Boolean, Proc] the configured policy # # @see auto_register= + # @api public setting :auto_register, default: true # @!method add_to_load_path=(policy) # # Sets whether the dir should be added to the `$LOAD_PATH` after the container @@ -58,18 +61,20 @@ # @param policy [Boolean] # @return [Boolean] # # @see add_to_load_path # @see Container.configure + # @api public # # @!method add_to_load_path # # Returns the configured value. # # @return [Boolean] # # @see add_to_load_path= + # @api public setting :add_to_load_path, default: true # @!method loader=(loader) # # Sets the loader to use when registering components from the dir in the @@ -83,18 +88,20 @@ # @return [#call] the configured loader # # @see loader # @see Loader # @see Loader::Autoloading + # @api public # # @!method loader # # Returns the configured loader. # # @return [#call] # # @see loader= + # @api public setting :loader, default: Dry::System::Loader # @!method memoize=(policy) # # Sets whether to memoize components from the dir when registered in the @@ -117,31 +124,35 @@ # !component.identifier.start_with?("providers") # end # # @see memoize # @see Component + # @api public # # @!method memoize # # Returns the configured memoization policy. # # @return [Boolean, Proc] the configured memoization policy # # @see memoize= + # @api public setting :memoize, default: false # @!method namespaces # # Returns the configured namespaces for the component dir. # # Allows namespaces to added on the returned object via {Namespaces#add}. # - # @see Namespaces#add - # # @return [Namespaces] the namespaces + # + # @see Namespaces#add + # @api public setting :namespaces, default: Namespaces.new, cloneable: true + # @api public 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", @@ -155,10 +166,11 @@ return if namespaces.namespaces[namespace_path] namespaces.add namespace_path, key: nil end + # @api public def default_namespace Dry::Core::Deprecations.announce( "Dry::System::Config::ComponentDir#default_namespace", "Use namespaces instead, e.g. `dir.namespaces`", tag: "dry-system", @@ -177,10 +189,10 @@ # Returns the component dir path, relative to the configured container root # # @return [String] the path attr_reader :path - # @api private + # @api public def initialize(path) super() @path = path yield self if block_given? end