Class: Dry::System::AutoRegistrar::Configuration Private

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/system/auto_registrar/configuration.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Default auto_registrar configuration

This is currently configured by default for every System::Container. Configuration allows to define custom initializtion logic as well as exclusion, for each component that is been register by Dry::System auto-registration.

Constant Summary collapse

DEFAULT_INSTANCE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

-> component { component.instance }.freeze
FALSE_PROC =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

-> * { false }.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Configuration.



32
33
34
35
# File 'lib/dry/system/auto_registrar/configuration.rb', line 32

def initialize
  @instance = DEFAULT_INSTANCE
  @exclude = FALSE_PROC
end

Class Method Details

.setting(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dry/system/auto_registrar/configuration.rb', line 16

def self.setting(name)
  define_method(name) do |&block|
    ivar = "@#{name}"

    if block
      instance_variable_set(ivar, block)
    else
      instance_variable_get(ivar)
    end
  end
end