Class: OrigenTesters::Generator::IdentityMap
- Inherits:
-
Object
- Object
- OrigenTesters::Generator::IdentityMap
- Defined in:
- lib/origen_testers/generator/identity_map.rb
Instance Method Summary collapse
- #current_version_of(obj) ⇒ Object
-
#initialize ⇒ IdentityMap
constructor
A new instance of IdentityMap.
- #map_for(obj) ⇒ Object
Constructor Details
#initialize ⇒ IdentityMap
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 |