Class: Flix::IdentityMap

Inherits:
Hash
  • Object
show all
Defined in:
lib/flix/identity_map.rb

Overview

Tracks objects to help ensure that each object gets loaded only once. See: www.martinfowler.com/eaaCatalog/identityMap.html

Instance Method Summary collapse

Instance Method Details

#fetch(id) ⇒ Object

Parameters:

  • id

Returns:

  • (Object)


9
10
11
# File 'lib/flix/identity_map.rb', line 9

def fetch(id)
  self[id]
end

#store(id, object) ⇒ Object

Parameters:

  • id
  • object

Returns:

  • (Object)


16
17
18
# File 'lib/flix/identity_map.rb', line 16

def store(id, object)
  self[id] = object
end