Method: Tk::BLT::Tree::Trace.id2obj

Defined in:
lib/tkextlib/blt/tree.rb

.id2obj(tree, id) ⇒ Object



479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
# File 'lib/tkextlib/blt/tree.rb', line 479

def self.id2obj(tree, id)
  tpath = tree.path
  TraceID_TBL.mutex.synchronize{
    if TraceID_TBL[tpath]
      if TraceID_TBL[tpath][id]
        TraceID_TBL[tpath][id]
      else
        begin
          # self.new([tree, id])
          (obj = self.allocate).instance_eval{
            @parent = @tree = tree
            @tpath = @parent.path
            @path = @id = node  # == traceID
            TraceID_TBL[@tpath] ||= {}
            TraceID_TBL[@tpath][@id] = self
          }
          obj
        rescue
          id
        end
      end
    else
      id
    end
  }
end