Class: Gloo::Core::Heap
- Inherits:
-
Object
- Object
- Gloo::Core::Heap
- Defined in:
- lib/gloo/core/heap.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
The context is a reference to an object, usually a container.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#it ⇒ Object
readonly
Returns the value of attribute it.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#error? ⇒ Boolean
Is there one or more errors?.
-
#initialize(engine) ⇒ Heap
constructor
Set up the object heap.
-
#unload(obj) ⇒ Object
Unload the given obj–remove it from the heap.
Constructor Details
#initialize(engine) ⇒ Heap
Set up the object heap.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gloo/core/heap.rb', line 22 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 |
Instance Attribute Details
#context ⇒ Object (readonly)
The context is a reference to an object, usually a container. The context will be the root by default.
15 16 17 |
# File 'lib/gloo/core/heap.rb', line 15 def context @context end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
17 18 19 |
# File 'lib/gloo/core/heap.rb', line 17 def error @error end |
#it ⇒ Object (readonly)
Returns the value of attribute it.
17 18 19 |
# File 'lib/gloo/core/heap.rb', line 17 def it @it end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
17 18 19 |
# File 'lib/gloo/core/heap.rb', line 17 def root @root end |
Instance Method Details
#error? ⇒ Boolean
Is there one or more errors?
47 48 49 |
# File 'lib/gloo/core/heap.rb', line 47 def error? return @error.error_count.positive? end |
#unload(obj) ⇒ Object
Unload the given obj–remove it from the heap.
37 38 39 40 41 42 |
# File 'lib/gloo/core/heap.rb', line 37 def unload( obj ) can = obj.parent.nil? ? @root : obj.parent return unless can can.remove_child obj end |