Module: Origami::ObjectCache

Included in:
CompoundObject
Defined in:
lib/origami/compound.rb

Overview

Module for maintaining internal caches of objects for fast lookup.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#names_cacheObject (readonly)

Returns the value of attribute names_cache.



29
30
31
# File 'lib/origami/compound.rb', line 29

def names_cache
  @names_cache
end

#strings_cacheObject (readonly)

Returns the value of attribute strings_cache.



29
30
31
# File 'lib/origami/compound.rb', line 29

def strings_cache
  @strings_cache
end

#xref_cacheObject (readonly)

Returns the value of attribute xref_cache.



29
30
31
# File 'lib/origami/compound.rb', line 29

def xref_cache
  @xref_cache
end

Instance Method Details

#initialize(*args) ⇒ Object



31
32
33
34
35
# File 'lib/origami/compound.rb', line 31

def initialize(*args)
    super(*args)

    init_caches
end

#rebuild_cachesObject



37
38
39
40
41
42
43
44
# File 'lib/origami/compound.rb', line 37

def rebuild_caches
    self.each do |*items|
        items.each do |object|
            object.rebuild_caches if object.is_a?(CompoundObject)
            cache_object(object)
        end
    end
end