class Dry::Plugins::Registry::Resolver

Default resolver for resolving plugins from registry

Public Instance Methods

call(container, name, require_path) click to toggle source

Resolve a plugin from the registry

@param container [Concurrent::Hash]

The container

@param name [Mixed]

The name for the plugin you wish to resolve

@raise [LoadError]

If the given plugin is not registered in the registry

@return [Mixed]

@api public If the registered plugin already exists, use it. Otherwise, require it and return it. This raises a LoadError if such a plugin doesn't exist, or a LoadError if it exists but it does not register itself correctly.

Calls superclass method
# File lib/dry/plugins/registry/resolver.rb, line 30
def call(container, name, require_path)
  name = name.to_s
  unless container.key?(name)
    path = Inflecto.underscore(name).tr('.', '/')
    require "#{require_path}/#{path}"
    raise LoadError.new(name, self) unless container.key?(name)
  end

  super(container, name)
end