class ObjectFramework::Persistence::IdentityMap
Public Class Methods
Source
# File lib/object_framework/persistence/session.rb, line 6 def initialize @entities = {} end
Public Instance Methods
Source
# File lib/object_framework/persistence/session.rb, line 12 def add(type, id, entity) existing = find(type, id) raise Duplicate, "Identity already belongs to another object" if existing && !existing.equal?(entity) @entities[[type, Values.detach(id)]] = entity end
Source
# File lib/object_framework/persistence/session.rb, line 19 def clear; @entities.clear; end
Source
# File lib/object_framework/persistence/session.rb, line 10 def find(type, id); @entities[[type, id]]; end
Source
# File lib/object_framework/persistence/session.rb, line 18 def remove(type, id); @entities.delete([type, id]); end