Class: ROM::PluginRegistry Private

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

Stores all registered plugins

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePluginRegistry

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 PluginRegistry.



44
45
46
47
48
49
50
# File 'lib/rom/plugin_registry.rb', line 44

def initialize
  @configuration = ConfigurationPluginRegistry.new
  @mappers = InternalPluginRegistry.new
  @commands = InternalPluginRegistry.new
  @relations = InternalPluginRegistry.new
  @schemas = InternalPluginRegistry.new(SchemaPlugin)
end

Instance Attribute Details

#commandsInternalPluginRegistry (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.

Internal registry for command plugins



20
21
22
# File 'lib/rom/plugin_registry.rb', line 20

def commands
  @commands
end

#configurationConfigurationPluginRegistry (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.

Internal registry for configuration plugins



13
14
15
# File 'lib/rom/plugin_registry.rb', line 13

def configuration
  @configuration
end

#mappersInternalPluginRegistry (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.

Internal registry for mapper plugins



27
28
29
# File 'lib/rom/plugin_registry.rb', line 27

def mappers
  @mappers
end

#relationsInternalPluginRegistry (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.

Internal registry for relation plugins



34
35
36
# File 'lib/rom/plugin_registry.rb', line 34

def relations
  @relations
end

#schemasInternalPluginRegistry (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.

Internal registry for schema plugins



41
42
43
# File 'lib/rom/plugin_registry.rb', line 41

def schemas
  @schemas
end

Instance Method Details

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

Register a plugin for future use

relation or mapper) applies to. Leave blank for all adapters

Parameters:

  • name (Symbol)

    The registration name for the plugin

  • mod (Module)

    The plugin to register

  • options (Hash) (defaults to: EMPTY_HASH)

    optional configuration data

Options Hash (options):

  • :type (Symbol)

    What type of plugin this is (command,

  • :adapter (Symbol) — default: :default

    which adapter this plugin



61
62
63
64
65
66
# File 'lib/rom/plugin_registry.rb', line 61

def register(name, mod, options = EMPTY_HASH)
  type    = options.fetch(:type)
  adapter = options.fetch(:adapter, :default)

  plugins_for(type, adapter).register(name, mod, options)
end