Sha256: 64e9500ccc37573d81ecfc28b0f610df7d6d0409153a3e6f084803e80e1888c6

Contents?: true

Size: 791 Bytes

Versions: 3

Compression:

Stored size: 791 Bytes

Contents

# encoding: utf-8

module ROM
  class Session

    # @api private
    class IdentityMap
      include Concord.new(:objects)

      class LoadedObject
        include Concord::Public.new(:object, :tuple)
      end

      # @api private
      def self.build(objects = {})
        new(objects)
      end

      # @api private
      def [](identity)
        objects[identity]
      end

      # @api private
      def fetch_object(identity, &block)
        objects.fetch(identity, &block).object
      end

      # @api private
      def fetch_tuple(identity)
        self[identity].tuple
      end

      # @api private
      def store(identity, object, tuple)
        objects[identity] = LoadedObject.new(object, tuple)
        self
      end

    end # IdentityMap

  end # Session
end # ROM

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
rom-0.2.0 lib/rom/session/identity_map.rb
rom-session-0.1.1 lib/rom/session/identity_map.rb
rom-session-0.1.0 lib/rom/session/identity_map.rb