Sha256: 66cdb5aa4c8e73b9381243287b57126f172bd94d1b91630881a9966924a8e742

Contents?: true

Size: 1.12 KB

Versions: 25

Compression:

Stored size: 1.12 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2019 Eric Crane.  All rights reserved.
#
# The Object Heap.
# The collection of objects that are currently in play in
# the running engine.
#

module Gloo
  module Core
    class Heap

      # The context is a reference to an object, usually a container.
      # The context will be the root by default.
      attr_reader :context

      attr_reader :it, :root, :error

      #
      # Set up the object heap.
      #
      def initialize( engine )
        @engine = engine
        @engine.log.debug 'object heap intialized...'

        @root = Gloo::Objs::Container.new( @engine )
        @root.name = 'root'

        @context = Pn.root @engine
        @it = It.new
        @error = Error.new
      end

      #
      # Unload the given obj--remove it from the heap.
      #
      def unload( obj )
        can = obj.parent.nil? ? @root : obj.parent
        return unless can

        can.remove_child obj
      end

      #
      # Is there one or more errors?
      #
      def error?
        return @error.error_count.positive?
      end

    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
gloo-3.8.0 lib/gloo/core/heap.rb
gloo-3.7.0 lib/gloo/core/heap.rb
gloo-3.6.2 lib/gloo/core/heap.rb
gloo-3.6.1 lib/gloo/core/heap.rb
gloo-3.6.0 lib/gloo/core/heap.rb
gloo-3.5.0 lib/gloo/core/heap.rb
gloo-3.4.1 lib/gloo/core/heap.rb
gloo-3.4.0 lib/gloo/core/heap.rb
gloo-3.3.0 lib/gloo/core/heap.rb
gloo-3.2.0 lib/gloo/core/heap.rb
gloo-3.1.1 lib/gloo/core/heap.rb
gloo-3.1.0 lib/gloo/core/heap.rb
gloo-3.0.1 lib/gloo/core/heap.rb
gloo-3.0.0 lib/gloo/core/heap.rb
gloo-2.5.0 lib/gloo/core/heap.rb
gloo-2.4.3 lib/gloo/core/heap.rb
gloo-2.4.2 lib/gloo/core/heap.rb
gloo-2.4.1 lib/gloo/core/heap.rb
gloo-2.4.0 lib/gloo/core/heap.rb
gloo-2.3.1 lib/gloo/core/heap.rb