Class: Dry::System::Booter::ComponentRegistry Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/dry/system/booter/component_registry.rb

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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeComponentRegistry

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 ComponentRegistry.


9
10
11
# File 'lib/dry/system/booter/component_registry.rb', line 9

def initialize
  @components = []
end

Instance Attribute Details

#componentsObject (readonly)

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.


7
8
9
# File 'lib/dry/system/booter/component_registry.rb', line 7

def components
  @components
end

Instance Method Details

#[](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.


25
26
27
28
29
30
31
32
33
# File 'lib/dry/system/booter/component_registry.rb', line 25

def [](name)
  component = components.detect { |component| component.identifier == name }

  if component
    component
  else
    raise InvalidComponentIdentifierError, name
  end
end

#each(&block) ⇒ 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.


13
14
15
# File 'lib/dry/system/booter/component_registry.rb', line 13

def each(&block)
  components.each(&block)
end

#exists?(name) ⇒ Boolean

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:

  • (Boolean)

21
22
23
# File 'lib/dry/system/booter/component_registry.rb', line 21

def exists?(name)
  components.any? { |component| component.identifier == name }
end

#register(component) ⇒ 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.


17
18
19
# File 'lib/dry/system/booter/component_registry.rb', line 17

def register(component)
  @components << component
end