class HNode

Attributes

childNodes[R]
createTimestamp[R]
obj[R]
parentNode[R]
updateTimestamp[RW]

Public Class Methods

new(obj, parentNode = nil, timestamp = Time.now.to_i) click to toggle source
# File lib/hengine/hmalloc.rb, line 8
def initialize(obj, parentNode = nil, timestamp = Time.now.to_i)
  @obj = obj
  @createTimestamp = timestamp
  @updateTimestamp = timestamp
  @parentNode = parentNode 
  @childNodes = []
end
showObj(obj: nil, margin: 0) click to toggle source
# File lib/hengine/hmalloc.rb, line 16
def self.showObj(obj: nil, margin: 0)
  if obj.class == Hash
    hl.<< ' ' * margin + "  => by connect: receiver: #{obj[:receiver].class} - method: #{obj[:method]}(#{obj[:args]})".green, "DEBUG2"
  elsif 
    hl.<< ' ' * margin + "  => by hm().malloc: #{obj}".green, "DEBUG2"
  end
end

Public Instance Methods

show(oid: nil, margin: 0) click to toggle source
# File lib/hengine/hmalloc.rb, line 28
def show(oid: nil, margin: 0)
  
  parentObj = @parentNode.obj if @parentNode
  poid = parentObj.object_id if parentObj
  str = "oid: #{oid} - #{@obj.class} - parent: #{parentObj.class} => poid: #{poid} - time: #{Time.at(@updateTimestamp).to_time.strftime("%H:%M:%S")}"

  if poid
    hl.<< ' ' * margin + str.yellow, "DEBUG2"
  else
    hl.<< ' ' * margin + str.red, "DEBUG2"
  end
  
  self.showObj(margin: margin)

end
showObj(margin: 0) click to toggle source
# File lib/hengine/hmalloc.rb, line 24
def showObj(margin: 0)
  HNode.showObj(obj: @obj, margin: margin)
end
showTree(oid: nil, margin: 0) click to toggle source
# File lib/hengine/hmalloc.rb, line 44
def showTree(oid: nil, margin: 0)
  self.show(oid: oid, margin: margin)
  @childNodes.each do |node|
    node.showTree(margin: margin + 3)
  end
end