Skip to content

Commit

Permalink
Merge pull request #34 from packetmonkey/fix_print_tree
Browse files Browse the repository at this point in the history
Correctly recurse print_tree method
  • Loading branch information
evolve75 committed Oct 25, 2014
2 parents a9b9c2f + e7c59d1 commit 3e6d7bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tree.rb
Expand Up @@ -849,7 +849,7 @@ def print_tree(level = 0, max_depth = nil, block = lambda { |node, prefix| puts

return unless max_depth.nil? || level < max_depth # Exit if the max level is defined, and reached.

children { |child| child.print_tree(level + 1, block) if child } # Child might be 'nil'
children { |child| child.print_tree(level + 1, max_depth, block) if child } # Child might be 'nil'
end

end
Expand Down

0 comments on commit 3e6d7bc

Please sign in to comment.