Sha256: 51ece9f24e2f14ef8733ef1c5532151c4ad9c256c1f2db6218760db0fd55fae2
Contents?: true
Size: 381 Bytes
Versions: 1
Compression:
Stored size: 381 Bytes
Contents
class Satisfaction::IdentityMap attr_reader :records, :pages def initialize @records = {} @pages = {} end def get_record(klass, id, &block) result = @records[[klass, id]] result ||= begin obj = yield(klass, id) @records[[klass, id]] = obj end result end def expire_record(klass, id) @records[[klass, id]] = nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby-satisfaction-0.2.0 | lib/satisfaction/identity_map.rb |