Sha256: ddb5cecea2175eb43de71b200e1b891cdbfc1b8bd82b79d3b92d0a6467d5f2a1

Contents?: true

Size: 393 Bytes

Versions: 4

Compression:

Stored size: 393 Bytes

Contents

module Wayback

  # Tracks objects to help ensure that each object gets loaded only once.
  # See: http://www.martinfowler.com/eaaCatalog/identityMap.html
  class IdentityMap < Hash

    # @param id
    # @return [Object]
    def fetch(id)
      self[id]
    end

    # @param id
    # @param object
    # @return [Object]
    def store(id, object)
      self[id] = object
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wayback-0.3.1 lib/wayback/identity_map.rb
wayback-0.2.1 lib/wayback/identity_map.rb
wayback-0.2.0 lib/wayback/identity_map.rb
wayback-0.1.0 lib/wayback/identity_map.rb