Class: Dry::System::IndirectComponent Private

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/system/indirect_component.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.

An indirect component is a component that cannot be directly from a source file directly managed by the container. It may be component that needs to be loaded indirectly, either via a registration manifest file or an imported container

Indirect components are an internal abstraction and, unlike ordinary components, are not exposed to users via component dir configuration hooks.

See Also:

  • Container.load_component
  • Container.find_component

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier) ⇒ IndirectComponent

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



24
25
26
# File 'lib/dry/system/indirect_component.rb', line 24

def initialize(identifier)
  @identifier = identifier
end

Instance Attribute Details

#identifierObject (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.



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

def identifier
  @identifier
end

Instance Method Details

#keyString

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 the component’s unique key

Returns:

  • (String)

    the key

See Also:



47
48
49
# File 'lib/dry/system/indirect_component.rb', line 47

def key
  identifier.to_s
end

#loadable?FalseClass

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 false, indicating that the component is not directly loadable from the files managed by the container

This is the inverse of Component#loadable?

Returns:

  • (FalseClass)


36
37
38
# File 'lib/dry/system/indirect_component.rb', line 36

def loadable?
  false
end

#root_keySymbol

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 the root namespace segment of the component’s key, as a symbol

Returns:

  • (Symbol)

    the root key

See Also:



58
59
60
# File 'lib/dry/system/indirect_component.rb', line 58

def root_key
  identifier.root_key
end