Method: Dom::Node#print_tree
- Defined in:
- lib/dom/node.rb
#print_tree ⇒ nil
Generates a text-output on console, representing the subtree-structure of the current node. The current node is not being printed.
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/dom/node.rb', line 343 def print_tree # Because parent = nil and parent = Dom.root are handled the same at #parents # we need to make a difference here if @parent.nil? level = 0 else level = parents.count + 1 end @children.each do |name, child| puts "#{" " * level}-#{name.to_s}#{' (NoDoc)' if child.is_a? NoDoc}" child.print_tree end nil end |