Sha256: dcb2d443677a46996aee06a49e7b3d6803037e9138ace7d0ddb79c72e9326e9d

Contents?: true

Size: 631 Bytes

Versions: 6

Compression:

Stored size: 631 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: -> do
      MapperCompiler.new(cache: cache)
    end

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

6 entries across 6 versions & 1 rubygems

Version Path
rom-core-5.1.2 lib/rom/mapper_registry.rb
rom-core-5.1.1 lib/rom/mapper_registry.rb
rom-core-5.1.0 lib/rom/mapper_registry.rb
rom-core-5.0.2 lib/rom/mapper_registry.rb
rom-core-5.0.1 lib/rom/mapper_registry.rb
rom-core-5.0.0 lib/rom/mapper_registry.rb