N-ary tree in Ruby