Class: RocketAMF::Pure::SerializerCache::ObjectCache
- Inherits:
-
Hash
- Object
- Hash
- RocketAMF::Pure::SerializerCache::ObjectCache
- Defined in:
- lib/rocketamf/pure/serializer.rb
Overview
:nodoc:
Instance Method Summary collapse
- #[](obj) ⇒ Object
- #add_obj(obj) ⇒ Object
-
#initialize ⇒ ObjectCache
constructor
A new instance of ObjectCache.
Constructor Details
#initialize ⇒ ObjectCache
Returns a new instance of ObjectCache.
457 458 459 460 |
# File 'lib/rocketamf/pure/serializer.rb', line 457 def initialize @cache_index = 0 @obj_references = [] end |
Instance Method Details
#[](obj) ⇒ Object
462 463 464 |
# File 'lib/rocketamf/pure/serializer.rb', line 462 def [] obj super(obj.object_id) end |
#add_obj(obj) ⇒ Object
466 467 468 469 470 |
# File 'lib/rocketamf/pure/serializer.rb', line 466 def add_obj obj @obj_references << obj self[obj.object_id] = @cache_index @cache_index += 1 end |