# File tk/lib/tkextlib/blt/treeview.rb, line 1058 def self.id2obj(tree, id) tpath = tree.path TreeNodeID_TBL.mutex.synchronize{ if TreeNodeID_TBL[tpath] if TreeNodeID_TBL[tpath][id] TreeNodeID_TBL[tpath][id] else begin # self.new(tree, nil, nil, 'node'=>Integer(id)) unless (tk_call(@tpath, 'get', id)).empty? id = Integer(id) (obj = self.allocate).instance_eval{ @parent = @tree = tree @tpath = @parent.path @path = @id = id TreeNodeID_TBL[@tpath] ||= {} TreeNodeID_TBL[@tpath][@id] = self } obj else id end rescue id end end else id end } end
# File tk/lib/tkextlib/blt/treeview.rb, line 1090 def self.new(tree, pos, parent=nil, keys={}) if parent.kind_of?(Hash) keys = parent parent = nil end keys = _symbolkey2str(keys) tpath = tree.path TreeNodeID_TBL.mutex.synchronize{ TreeNodeID_TBL[tpath] ||= {} if (id = keys['node']) && (obj = TreeNodeID_TBL[tpath][id]) keys.delete('node') tk_call(tree.path, 'move', id, pos, parent) if parent return obj end #super(tree, pos, parent, keys) (obj = self.allocate).instance_eval{ initialize(tree, pos, parent, keys) TreeNodeID_TBL[tpath][@id] = self } obj } end
# File tk/lib/tkextlib/blt/treeview.rb, line 1116 def initialize(tree, pos, parent, keys) @parent = @tree = tree @tpath = @parent.path if (id = keys['node']) # if tk_call(@tpath, 'get', id).empty? # fail RuntimeError, "not exist the node '#{id}'" # end @path = @id = id tk_call(@tpath, 'move', @id, pos, tagid(parent)) if parent configure(keys) if keys && ! keys.empty? else name = nil TreeNode_ID.mutex.synchronize{ name = TreeNode_ID.join(TkCore::INTERP._ip_id_).freeze TreeNode_ID[1].succ! } at = keys.delete['at'] if parent if parent.kind_of?(Tk::BLT::Treeview::Node) || parent.kind_of?(Tk::BLT::Treeview::Tag) path = [get_full(parent.id)[0], name] at = nil # ignore 'at' option else path = [parent.to_s, name] end else path = name end if at @id = tk_call(@tpath, 'insert', '-at', tagid(at), pos, path, keys) else @id = tk_call(@tpath, 'insert', pos, path, keys) end @path = @id end 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.