Class: ROM::PluginRegistryBase Private

Inherits:
Registry
  • Object
show all
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.

Abstract registry defining common behaviour

Instance Attribute Summary

Attributes inherited from Registry

#cache, #elements

Instance Method Summary collapse

Methods inherited from Registry

#each, element_not_found_error, #fetch, #key?, #map, new, #respond_to_missing?

Methods included from Initializer

extended

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ROM::Registry

Instance Method Details

#[](name) ⇒ Plugin

Retrieve a registered plugin



101
102
103
# File 'lib/rom/plugin_registry.rb', line 101

def [](name)
  elements[name]
end

#plugin_name(plugin) ⇒ Symbol

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 plugin name by instance



121
122
123
124
# File 'lib/rom/plugin_registry.rb', line 121

def plugin_name(plugin)
 tuple = elements.find { |(_, p)| p.equal?(plugin) }
 tuple[0] if tuple
end

#register(name, mod, options) ⇒ 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.

Assign a plugin to this environment registry



112
113
114
# File 'lib/rom/plugin_registry.rb', line 112

def register(name, mod, options)
  elements[name] = plugin_type.new(mod, options)
end