Class: RocketAMF::Pure::ObjectCache

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeObjectCache

Returns a new instance of ObjectCache.



4
5
6
7
# File 'lib/rocketamf/pure/helpers/object_cache.rb', line 4

def initialize
  @cache_index    = 0
  @obj_references = []
end

Instance Method Details

#[](obj) ⇒ Object



9
10
11
# File 'lib/rocketamf/pure/helpers/object_cache.rb', line 9

def [](obj)
  super(obj.object_id)
end

#add_obj(obj) ⇒ Object



13
14
15
16
17
# File 'lib/rocketamf/pure/helpers/object_cache.rb', line 13

def add_obj(obj)
  @obj_references << obj
  self[obj.object_id] = @cache_index
  @cache_index        += 1
end