Class: Twitter::IdentityMap

Inherits:
Hash
  • Object
show all
Defined in:
lib/twitter/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

Methods inherited from Hash

#except, #except!, #merge_list!, #merge_owner!, #merge_user, #merge_user!, #merge_users, #merge_users!

Instance Method Details

#fetch(id) ⇒ Object

Parameters:

  • id

Returns:

  • (Object)


9
10
11
# File 'lib/twitter/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/twitter/identity_map.rb', line 16

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