Sha256: ce4b31bb0542eb839e0b81d5790c6096893d8b4f72d4eff58bcbfbf41c62a2aa
Contents?: true
Size: 435 Bytes
Versions: 1
Compression:
Stored size: 435 Bytes
Contents
require 'data_mapper/support/weak_hash' module DataMapper class IdentityMap def initialize @cache = Hash.new { |h,k| h[k] = Support::WeakHash.new } end def get(klass, key) @cache[klass][key] end def set(instance) raise "Can't store an instance with a nil key in the IdentityMap" if instance.key == nil @cache[instance.class][instance.key] = instance end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
datamapper-0.1.0 | lib/data_mapper/identity_map.rb |