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.



22
23
24
25
26
# File 'lib/rom/plugin_base.rb', line 22

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



11
12
13
# File 'lib/rom/plugin_base.rb', line 11

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



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

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.



19
20
21
# File 'lib/rom/plugin_base.rb', line 19

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)


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

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)


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

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)


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

def schema?
  type == :schema
end