Class: Flows::Plugin::DependencyInjector::DependencyList Private

Inherits:
Object
  • Object
show all
Defined in:
lib/flows/plugin/dependency_injector/dependency_list.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.

Resolves dependencies on initialization and can inject it into class instance.

Since:

  • 0.4.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass:, definitions:, provided_values:) ⇒ DependencyList

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

Since:

  • 0.4.0



10
11
12
13
14
15
16
17
18
# File 'lib/flows/plugin/dependency_injector/dependency_list.rb', line 10

def initialize(klass:, definitions:, provided_values:)
  @klass = klass
  @definitions = definitions
  @provided_values = provided_values.dup.tap { |pv| pv.default = NO_VALUE }

  check_missing_dependencies
  check_unexpected_dependencies
  resolve_dependencies
end

Instance Attribute Details

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

Since:

  • 0.4.0



8
9
10
# File 'lib/flows/plugin/dependency_injector/dependency_list.rb', line 8

def definitions
  @definitions
end

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

Since:

  • 0.4.0



8
9
10
# File 'lib/flows/plugin/dependency_injector/dependency_list.rb', line 8

def dependencies
  @dependencies
end

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

Since:

  • 0.4.0



8
9
10
# File 'lib/flows/plugin/dependency_injector/dependency_list.rb', line 8

def provided_values
  @provided_values
end

Instance Method Details

#inject_to(instance) ⇒ 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.

Since:

  • 0.4.0



20
21
22
# File 'lib/flows/plugin/dependency_injector/dependency_list.rb', line 20

def inject_to(instance)
  dependencies.each { |dep| dep.inject_to(instance) }
end