Class: RocketAMF::Pure::SerializerCache::ObjectCache

Inherits:
Hash
  • Object
show all
Defined in:
lib/rocketamf/pure/serializer.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeObjectCache

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