Class: OrigenTesters::Generator::IdentityMap

Inherits:
Object
  • Object
show all
Defined in:
lib/origen_testers/generator/identity_map.rb

Instance Method Summary collapse

Constructor Details

#initializeIdentityMap

Returns a new instance of IdentityMap.


4
5
6
7
# File 'lib/origen_testers/generator/identity_map.rb', line 4

def initialize
  @store = {}
  @versions = {}
end

Instance Method Details

#current_version_of(obj) ⇒ Object


9
10
11
12
13
14
15
16
# File 'lib/origen_testers/generator/identity_map.rb', line 9

def current_version_of(obj)
  map = map_for(obj)
  if map
    map[:replaced_by] || map[:instance]
  else
    obj
  end
end

#map_for(obj) ⇒ Object


18
19
20
# File 'lib/origen_testers/generator/identity_map.rb', line 18

def map_for(obj)
  @store[obj.object_id]
end