Sha256: c9916a5fdfb0f44a6741ce38b97aa96b280c47f7060fa1e20f11a9caa647f279

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require "dry/system/constants"
require "dry/system/plugins/dependency_graph/strategies"

module Dry
  module System
    module Plugins
      # @api public
      module DependencyGraph
        # @api private
        def self.extended(system)
          super

          system.use(:notifications)

          system.before(:configure) do
            setting :ignored_dependencies, []
          end

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

            strategies(Strategies)
          end
        end

        # @api private
        def self.dependencies
          {'dry-events': "dry/events/publisher"}
        end

        # @api private
        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
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dry-system-0.19.2 lib/dry/system/plugins/dependency_graph.rb
dry-system-0.18.2 lib/dry/system/plugins/dependency_graph.rb
dry-system-0.19.1 lib/dry/system/plugins/dependency_graph.rb
dry-system-0.19.0 lib/dry/system/plugins/dependency_graph.rb
dry-system-0.18.1 lib/dry/system/plugins/dependency_graph.rb
dry-system-0.18.0 lib/dry/system/plugins/dependency_graph.rb