Class: GlooLang::Core::ObjFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/gloo_lang/core/obj_finder.rb

Class Method Summary collapse

Class Method Details

.by_name(engine, name, container = nil) ⇒ Object

Find all objects in the given container that have the given name. If the container isn’t provided, root will be used.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gloo_lang/core/obj_finder.rb', line 16

def self.by_name( engine, name, container = nil )
  container = engine.heap.root if container.nil?
  arr = []

  container.children.each do |o|
    arr << o if o.name == name
    arr += by_name( engine, name, o ) if o.child_count.positive?
  end

  return arr
end