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 initialization as well as exclusion logic, for each component that is being registered 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

Instance Attribute Summary collapse

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.



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

def initialize
  @instance = DEFAULT_INSTANCE
  @exclude = FALSE_PROC
  @memoize = false
end

Instance Attribute Details

#memoizeObject

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.



30
31
32
# File 'lib/dry/system/auto_registrar/configuration.rb', line 30

def memoize
  @memoize
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
# 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