Update tree.rb

Direction attribute to ancestors method