Class: ROM::PluginBase

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/plugin_base.rb

Overview

Abstract plugin base

Direct Known Subclasses

ConfigurationPlugin, Plugin, SchemaPlugin

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mod, options) ⇒ PluginBase

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



20
21
22
23
24
# File 'lib/rom/plugin_base.rb', line 20

def initialize(mod, options)
  @mod      = mod
  @options  = options
  @type = options.fetch(:type)
end

Instance Attribute Details

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

Returns a module representing the plugin.

Returns:

  • (Module)

    a module representing the plugin



9
10
11
# File 'lib/rom/plugin_base.rb', line 9

def mod
  @mod
end

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

Returns configuration options.

Returns:

  • (Hash)

    configuration options



14
15
16
# File 'lib/rom/plugin_base.rb', line 14

def options
  @options
end

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



17
18
19
# File 'lib/rom/plugin_base.rb', line 17

def type
  @type
end

Instance Method Details

#apply_to(_base) ⇒ 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.

Apply this plugin to the provided class

Parameters:

  • _base (Mixed)

Raises:

  • (NotImplementedError)


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

def apply_to(_base)
  raise NotImplementedError, "#{self.class}#apply_to not implemented"
end

#relation?Boolean

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:

  • (Boolean)


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

def relation?
  type == :relation
end

#schema?Boolean

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:

  • (Boolean)


32
33
34
# File 'lib/rom/plugin_base.rb', line 32

def schema?
  type == :schema
end