Class: ROM::MapperRegistry

Inherits:
Registry show all
Defined in:
lib/rom/mapper_registry.rb

Instance Attribute Summary collapse

Attributes inherited from Registry

#cache, #elements

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Registry

#each, #fetch, #key?, #map, #merge, new, #respond_to_missing?, #to_hash

Methods included from Initializer

extended

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ROM::Registry

Instance Attribute Details

#compilerMapperCompiler (readonly)

Returns A mapper compiler instance.

Returns:

  • (MapperCompiler)

    A mapper compiler instance



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

option :compiler, default: -> do
  MapperCompiler.new(cache: cache)
end

Class Method Details

.element_not_found_errorObject

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.



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

def self.element_not_found_error
  MapperMissingError
end

Instance Method Details

#[](*args) ⇒ Object

See Also:



21
22
23
24
25
26
27
# File 'lib/rom/mapper_registry.rb', line 21

def [](*args)
  if args[0].is_a?(Symbol)
    super
  else
    cache.fetch_or_store(args.hash) { compiler.(*args) }
  end
end