Class: ROM::InternalPluginRegistry Private
- Inherits:
-
Object
- Object
- ROM::InternalPluginRegistry
- Defined in:
- lib/rom/plugin_registry.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.
Store a set of registries grouped by adapter
Instance Attribute Summary collapse
-
#registries ⇒ Hash
readonly
private
Return the existing registries.
Instance Method Summary collapse
-
#adapter(name) ⇒ AdapterRegistry
private
Return the plugin registry for a specific adapter.
-
#fetch(name, adapter_name = :default) ⇒ Object
(also: #[])
Return the plugin for a given adapter.
-
#initialize(plugin_type = Plugin) ⇒ InternalPluginRegistry
constructor
private
A new instance of InternalPluginRegistry.
Constructor Details
#initialize(plugin_type = Plugin) ⇒ InternalPluginRegistry
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 InternalPluginRegistry.
167 168 169 |
# File 'lib/rom/plugin_registry.rb', line 167 def initialize(plugin_type = Plugin) @registries = Hash.new { |h, v| h[v] = AdapterPluginRegistry.new({}, plugin_type: plugin_type) } end |
Instance Attribute Details
#registries ⇒ Hash (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.
Return the existing registries
164 165 166 |
# File 'lib/rom/plugin_registry.rb', line 164 def registries @registries end |
Instance Method Details
#adapter(name) ⇒ AdapterRegistry
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.
Return the plugin registry for a specific adapter
178 179 180 |
# File 'lib/rom/plugin_registry.rb', line 178 def adapter(name) registries[name] end |
#fetch(name, adapter_name = :default) ⇒ Object Also known as: []
Return the plugin for a given adapter
190 191 192 193 |
# File 'lib/rom/plugin_registry.rb', line 190 def fetch(name, adapter_name = :default) adapter(adapter_name)[name] || adapter(:default)[name] || raise(UnknownPluginError, name) end |