Class: SequelMapper::IdentityMap
- Inherits:
-
Object
- Object
- SequelMapper::IdentityMap
- Defined in:
- lib/sequel_mapper/identity_map.rb
Instance Method Summary collapse
- #call(record, object) ⇒ Object
-
#initialize(storage) ⇒ IdentityMap
constructor
A new instance of IdentityMap.
Constructor Details
#initialize(storage) ⇒ IdentityMap
Returns a new instance of IdentityMap.
3 4 5 |
# File 'lib/sequel_mapper/identity_map.rb', line 3 def initialize(storage) @storage = storage end |
Instance Method Details
#call(record, object) ⇒ Object
10 11 12 13 14 |
# File 'lib/sequel_mapper/identity_map.rb', line 10 def call(record, object) storage.fetch(hash_key(record)) { storage.store(hash_key(record), object) } end |