Class: Terrestrial::IdentityMap
- Inherits:
-
Object
- Object
- Terrestrial::IdentityMap
- Defined in:
- lib/terrestrial/identity_map.rb
Instance Method Summary collapse
- #call(mapping, 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/terrestrial/identity_map.rb', line 3 def initialize(storage) @storage = storage end |
Instance Method Details
#call(mapping, record, object) ⇒ Object
10 11 12 13 14 |
# File 'lib/terrestrial/identity_map.rb', line 10 def call(mapping, record, object) storage.fetch(hash_key(mapping, record)) { storage.store(hash_key(mapping, record), object) } end |