Sha256: cab1001c31c473f185e9b8f93ad8146ad3f1b4c12823154ea0c3ea213eac9ed9

Contents?: true

Size: 704 Bytes

Versions: 23

Compression:

Stored size: 704 Bytes

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2019 Eric Crane.  All rights reserved.
#
# Utility used to find objects.
#

module GlooLang
  module Core
    class ObjFinder

      #
      # Find all objects in the given container that have
      # the given name.
      # If the container isn't provided, root will be used.
      #
      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

    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
gloo-lang-1.4.3 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.4.2 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.4.1 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.4.0 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.3.2 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.3.1 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.3.0 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.2.8 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.2.7 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.2.6 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.2.5 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.2.4 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.2.3 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.2.2 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.2.1 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.2.0 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.1.0 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.0.2 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.0.1 lib/gloo_lang/core/obj_finder.rb
gloo-lang-1.0.0 lib/gloo_lang/core/obj_finder.rb