def node(name, type = Node, &block)
      parent = @nodes_stack.empty? ? Node::ROOT : @nodes_stack.last
      level = [0, @nodes_stack.size - 1].max
      prefix = ':pipe' * level
      if parent.class == LeafNode
        prefix = ':space' * level
      end
      node = type.new(name, parent.full_path, prefix, @nodes_stack.size)
      @nodes << node

      return unless block_given?

      @nodes_stack << node
      if block.arity.zero?
        instance_eval(&block)
      else
        instance_eval(&(->(*_args) { block[node] }))
      end
      @nodes_stack.pop
    end
def node(name, type = Node, &block)
      parent = @nodes_stack.empty? ? Node::ROOT : @nodes_stack.last
      level = [0, @nodes_stack.size - 1].max
      prefix = ':pipe' * level
      if parent.class == LeafNode
        prefix = ':space' * level
      end
      node = type.new(name, parent.full_path, prefix, @nodes_stack.size)
      @nodes << node

      return unless block_given?

      @nodes_stack << node
      if block.arity.zero?
        instance_eval(&block)
      else
        instance_eval(&(->(*_args) { block[node] }))
      end
      @nodes_stack.pop
    end
Create a Tree

 @param [String,Dir,Hash] data

 @api public
 Add node to this tree.

 @param [Symbol,String] name
   the name for the node

 @param [Node, LeafNode] type
   the type of node to add

 @example
   TTY::Tree.new do
     node '...' do
       node '...'
     end
   end

 @api public