Sha256: 5c80816c1ae679012a406471705c86abd52a2ae192a020805d04a870550866f9

Contents?: true

Size: 477 Bytes

Versions: 2

Compression:

Stored size: 477 Bytes

Contents

require 'dry/core/cache'
require 'rom/mapper'
require 'rom/repository/header_builder'

module ROM
  class Repository
    # @api private
    class MapperBuilder
      extend Dry::Core::Cache

      attr_reader :header_builder

      def initialize(options = EMPTY_HASH)
        @header_builder = HeaderBuilder.new(options)
      end

      def call(ast)
        fetch_or_store(ast) { Mapper.build(header_builder[ast]) }
      end
      alias_method :[], :call
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-repository-1.4.0 lib/rom/repository/mapper_builder.rb
rom-repository-1.3.3 lib/rom/repository/mapper_builder.rb