Class: EntityReferences
- Inherits:
-
Object
- Object
- EntityReferences
- Defined in:
- lib/store/entity_references.rb
Instance Method Summary collapse
- #find(entity) ⇒ Object
-
#initialize ⇒ EntityReferences
constructor
A new instance of EntityReferences.
- #remove(entity) ⇒ Object
- #save(id, entity) ⇒ Object
Constructor Details
#initialize ⇒ EntityReferences
Returns a new instance of EntityReferences.
2 3 4 |
# File 'lib/store/entity_references.rb', line 2 def initialize @hash = Hash.new end |
Instance Method Details
#find(entity) ⇒ Object
10 11 12 |
# File 'lib/store/entity_references.rb', line 10 def find(entity) @hash[entity.object_id] end |
#remove(entity) ⇒ Object
14 15 16 |
# File 'lib/store/entity_references.rb', line 14 def remove(entity) @hash.delete entity.object_id end |
#save(id, entity) ⇒ Object
6 7 8 |
# File 'lib/store/entity_references.rb', line 6 def save(id, entity) @hash[entity.object_id] = id end |