# File htree/traverse.rb, line 69 def each_with_path(prefix=nil) return unless @children count = {} @children.each {|c| node_test = c.node_test count[node_test] ||= 0 count[node_test] += 1 } pos = {} @children.each {|c| node_test = c.node_test pos[node_test] ||= 0 n = pos[node_test] += 1 child_path = node_test child_path += "[#{n}]" unless n == 1 && count[node_test] == 1 if prefix yield c, "#{prefix}/#{child_path}" else yield c, child_path end } end