Sha256: 9a0b46d51b05fd84d46bb387dece7e8d3ab3ddc25b72ff160660ebde8ce3bd75

Contents?: true

Size: 644 Bytes

Versions: 9

Compression:

Stored size: 644 Bytes

Contents

# frozen_string_literal: true

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

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

    # @!attribute [r] compiler
    #   @return [MapperCompiler] A mapper compiler instance
    option :compiler, default: lambda {
      MapperCompiler.new(EMPTY_HASH, cache: cache)
    }

    # @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

9 entries across 9 versions & 1 rubygems

Version Path
rom-core-5.3.2 lib/rom/mapper_registry.rb
rom-core-5.3.1 lib/rom/mapper_registry.rb
rom-core-5.3.0 lib/rom/mapper_registry.rb
rom-core-5.2.6 lib/rom/mapper_registry.rb
rom-core-5.2.5 lib/rom/mapper_registry.rb
rom-core-5.2.4 lib/rom/mapper_registry.rb
rom-core-5.2.3 lib/rom/mapper_registry.rb
rom-core-5.2.2 lib/rom/mapper_registry.rb
rom-core-5.2.1 lib/rom/mapper_registry.rb