# File tk/lib/tkextlib/blt/tree.rb, line 478 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
# File tk/lib/tkextlib/blt/tree.rb, line 505 def self.new(tree, *args, &b) TraceID_TBL.mutex.synchronize{ if tree.kind_of?(Array) # not create tpath = tree[0].path TraceID_TBL[tpath] ||= {} unless (obj = TraceID_TBL[tpath][tree[1]]) (TraceID_TBL[tpath][tree[1]] = obj = self.allocate).instance_eval{ @parent = @tree = tree @tpath = @parent.path @path = @id = tree[1] # == traceID } end return obj end # super(true, tree, *args, &b) (obj = self.allocate).instance_eval{ initialize(tree, *args, &b) TraceID_TBL[@tpath] ||= {} TraceID_TBL[@tpath][@id] = self } return obj } end
# File tk/lib/tkextlib/blt/tree.rb, line 532 def initialize(tree, node, key, opts, cmd=nil, &b) @parent = @tree = tree @tpath = @parent.path if !cmd if b cmd = Proc.new(&b) else fail ArgumentError, "lack of 'command' argument" end end @path = @id = tk_call(@tpath, 'trace', 'create', node, key, opts, proc{|t, id, k, ops| tobj = Tk::BLT::Tree.id2obj(t) if tobj.kind_of?(Tk::BLT::Tree) nobj = Tk::BLT::Tree::Node.id2obj(tobj, id) else nobj = id end cmd.call(tobj, nobj, k, ops) }) end
Commenting is here to help enhance the documentation. For example, sample code, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.