Module: ROM::Mapper::DSL::ClassMethods

Defined in:
core/lib/rom/mapper/dsl.rb

Overview

Class methods for all mappers

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)

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.

Delegate Attribute DSL method to the dsl instance



109
110
111
112
113
114
115
# File 'core/lib/rom/mapper/dsl.rb', line 109

def method_missing(name, *args, &block)
  if dsl.respond_to?(name)
    dsl.public_send(name, *args, &block)
  else
    super
  end
end

Instance Method Details

#use(plugin, options = {}) ⇒ Object

include a registered plugin in this mapper

Parameters:

  • plugin (Symbol)
  • options (Hash) (defaults to: {})

Options Hash (options):

  • :adapter (Symbol) — default: :default

    first adapter to check for plugin



40
41
42
43
44
# File 'core/lib/rom/mapper/dsl.rb', line 40

def use(plugin, options = {})
  adapter = options.fetch(:adapter, :default)

  ROM.plugin_registry[:mapper].fetch(plugin, adapter).apply_to(self)
end