Class: Dry::Plugins::Registry::Resolver
- Inherits:
-
Container::Resolver
- Object
- Container::Resolver
- Dry::Plugins::Registry::Resolver
- Defined in:
- lib/dry/plugins/registry/resolver.rb
Overview
Default resolver for resolving plugins from registry
Instance Method Summary collapse
-
#call(container, name, require_path) ⇒ Mixed
Resolve a plugin from the registry.
Instance Method Details
#call(container, name, require_path) ⇒ Mixed
Resolve a plugin from the registry
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.
30 31 32 33 34 35 36 37 38 39 |
# 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 |