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.



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

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



22
23
24
# File 'lib/rom/plugin_registry.rb', line 22

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



15
16
17
# File 'lib/rom/plugin_registry.rb', line 15

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



29
30
31
# File 'lib/rom/plugin_registry.rb', line 29

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



36
37
38
# File 'lib/rom/plugin_registry.rb', line 36

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



43
44
45
# File 'lib/rom/plugin_registry.rb', line 43

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



63
64
65
66
67
68
# File 'lib/rom/plugin_registry.rb', line 63

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