# File tk/lib/tkextlib/blt/tree.rb, line 375 def self.id2obj(tree, id) tpath = tree.path NotifyID_TBL.mutex.synchronize{ if NotifyID_TBL[tpath] if NotifyID_TBL[tpath][id] NotifyID_TBL[tpath][id] else (obj = self.allocate).instance_eval{ @parent = @tree = tree @tpath = @parent.path @path = @id = id NotifyID_TBL[@tpath] ||= {} NotifyID_TBL[@tpath][@id] = self } obj end else return id end } end
# File tk/lib/tkextlib/blt/tree.rb, line 397 def self.new(tree, *args, &b) NotifyID_TBL.mutex.synchronize{ if tree.kind_of?(Array) # not create tpath = tree[0].path NotifyID_TBL[tpath] ||= {} unless (obj = NotifyID_TBL[tpath][tree[1]]) (NotifyID_TBL[tpath][tree[1]] = obj = self.allocate).instance_eval{ @parent = @tree = tree[0] @tpath = @parent.path @path = @id = tree[1] } end return obj end (obj = self.allocate).instance_eval{ initialize(tree, *args, &b) NotifyID_TBL[@tpath] ||= {} NotifyID_TBL[@tpath][@id] = self } return obj } end
# File tk/lib/tkextlib/blt/tree.rb, line 423 def initialize(tree, *args, &b) @parent = @tree = tree @tpath = @parent.path # if args[0].kind_of?(Proc) || args[0].kind_of?(Method) if TkComm._callback_entry?(args[0]) cmd = args.shift # elsif args[-1].kind_of?(Proc) || args[-1].kind_of?(Method) elsif TkComm._callback_entry?(args[-1]) cmd = args.pop elsif b cmd = Proc.new(&b) else fail ArgumentError, "lack of 'command' argument" end args = args.collect{|arg| '-' << arg.to_s} args << proc{|id, type| cmd.call(Tk::BLT::Tree::Node.id2obj(@tree, id), ((type[0] == ?-)? type[1..-1]: type)) } @path = @id = tk_call(@tpath, 'notify', 'create', *args) end
Commenting is here to help enhance the documentation. For example, code samples, 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.
If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.