module UniverseCompiler::Universe::Index
Attributes
by_name[R]
by_type[R]
by_uniq_key[R]
Private Instance Methods
index(entity)
click to toggle source
# File lib/universe_compiler/universe/index.rb, line 18 def index(entity) # Non unique indices by_name[entity.name] ||= [] by_type[entity.type] ||= [] by_name[entity.name] << entity by_type[entity.type] << entity # Unique index ref = entity.respond_to?(:to_composite_key) ? entity.to_composite_key : [entity.type, entity.name] by_uniq_key[ref] = entity end
reindex_all(entities)
click to toggle source
# File lib/universe_compiler/universe/index.rb, line 29 def reindex_all(entities) clear_indices entities.each do |entity| index entity end end
setup_indices()
click to toggle source
# File lib/universe_compiler/universe/index.rb, line 10 def setup_indices @by_name = {} @by_type = {} @by_uniq_key = {} end
Also aliased as: clear_indices