Sha256: 276be59f019c4ff3599a83d92104b43eeb3450484e6ef9111b81d70f83a94450

Contents?: true

Size: 600 Bytes

Versions: 5

Compression:

Stored size: 600 Bytes

Contents

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

5 entries across 5 versions & 1 rubygems

Version Path
rom-core-4.2.1 lib/rom/mapper_registry.rb
rom-core-4.2.0 lib/rom/mapper_registry.rb
rom-core-4.1.2 lib/rom/mapper_registry.rb
rom-core-4.1.1 lib/rom/mapper_registry.rb
rom-core-4.1.0 lib/rom/mapper_registry.rb