Module: Dry::System::Plugins::DependencyGraph

Defined in:
lib/dry/system/plugins/dependency_graph.rb,
lib/dry/system/plugins/dependency_graph/strategies.rb

Defined Under Namespace

Classes: Strategies

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.dependenciesObject

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.



28
29
30
# File 'lib/dry/system/plugins/dependency_graph.rb', line 28

def self.dependencies
  'dry/events/publisher'
end

.extended(system) ⇒ 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.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/dry/system/plugins/dependency_graph.rb', line 12

def self.extended(system)
  super

  system.use(:notifications)

  system.setting :ignored_dependencies, []

  system.after(:configure) do
    self[:notifications].register_event(:resolved_dependency)
    self[:notifications].register_event(:registered_dependency)

    strategies(Strategies)
  end
end

Instance Method Details

#register(key, contents = nil, options = {}, &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.



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/dry/system/plugins/dependency_graph.rb', line 33

def register(key, contents = nil, options = {}, &block)
  super

  unless config.ignored_dependencies.include?(key.to_sym)
    self[:notifications].instrument(
      :registered_dependency, key: key, class: self[key].class
    )
  end

  self
end