Sha256: cf11cebf3a1b989918fdb77b6dcdc33342babba5dffeb661d001b0a025b94543

Contents?: true

Size: 463 Bytes

Versions: 3

Compression:

Stored size: 463 Bytes

Contents

require 'rom/struct'
require 'rom/registry'
require 'rom/mapper_compiler'

module ROM
  # @private
  class MapperRegistry < Registry
    def self.element_not_found_error
      MapperMissingError
    end

    option :compiler, default: -> { MapperCompiler.new }

    # @see Registry
    # @api public
    def [](*args)
      if args[0].is_a?(Symbol)
        super
      else
        cache.fetch_or_store(args.hash) { compiler.(*args) }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rom-core-4.0.0.beta3 lib/rom/mapper_registry.rb
rom-core-4.0.0.beta2 lib/rom/mapper_registry.rb
rom-core-4.0.0.beta1 lib/rom/mapper_registry.rb