Module: ROM::Global

Included in:
ROM
Defined in:
lib/rom/global.rb,
lib/rom/compat/global.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#adaptersHash<Symbol=>Module> (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.

An internal adapter identifier => adapter module map used by setup

Returns:

  • (Hash<Symbol=>Module>)


24
25
26
# File 'lib/rom/global.rb', line 24

def adapters
  @adapters
end

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

An internal component handler registry

Returns:



31
32
33
# File 'lib/rom/global.rb', line 31

def handlers
  @handlers
end

Class Method Details

.extended(rom) ⇒ 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.

Set base global registries in ROM constant



13
14
15
16
17
# File 'lib/rom/global.rb', line 13

def self.extended(rom)
  super

  rom.instance_variable_set("@adapters", {})
end

Instance Method Details

#register_adapter(identifier, adapter) ⇒ self

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 adapter namespace under a specified identifier

Parameters:

  • identifier (Symbol)
  • adapter (Class, Module)

Returns:

  • (self)


51
52
53
54
# File 'lib/rom/global.rb', line 51

def register_adapter(identifier, adapter)
  adapters[identifier] = adapter
  self
end

#setup(*args, &block) ⇒ Object Also known as: container



34
35
36
37
38
39
40
41
# File 'lib/rom/global.rb', line 34

def setup(*args, &block)
  case args.first
  when Setup
    args.first
  else
    Setup.new(*args, &block)
  end.finalize
end