Sha256: dc452850c7d0b54ab33fe960df0073921a9f3b35c42d80443eea9dd230a327f6

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 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 GlooLang
  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
        $log.debug 'object heap intialized...'

        @root = GlooLang::Objs::Container.new
        @root.name = 'root'

        @context = Pn.root
        @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

6 entries across 6 versions & 1 rubygems

Version Path
gloo-lang-0.9.8 lib/gloo_lang/core/heap.rb
gloo-lang-0.9.7 lib/gloo_lang/core/heap.rb
gloo-lang-0.9.6 lib/gloo_lang/core/heap.rb
gloo-lang-0.9.5 lib/gloo_lang/core/heap.rb
gloo-lang-0.9.4 lib/gloo_lang/core/heap.rb
gloo-lang-0.9.3 lib/gloo_lang/core/heap.rb