def traverse(node=nil, &block)
      return self.to_enum unless block_given?
      node_stack = [node || self]
      until node_stack.empty?
        current = node_stack.shift
        if current
          yield current
          node_stack = node_stack.insert(0, *current.nodes) if current.respond_to?(:nodes)
        end
      end
      node || self if block_given?
    end
def traverse(node=nil, &block)
      return self.to_enum unless block_given?
      node_stack = [node || self]
      until node_stack.empty?
        current = node_stack.shift
        if current
          yield current
          node_stack = node_stack.insert(0, *current.nodes) if current.respond_to?(:nodes)
        end
      end
      node || self if block_given?
    end
pre-order traverse through this node and all of its descendants

 @param &block [block] code to execute for each yielded node