Class: TreeGraph::TopDown

Inherits:
Object show all
Includes:
Node
Defined in:
lib/tree_graph.rb

Instance Attribute Summary

Attributes included from Node

#is_last, #parent, #raw_node

Instance Method Summary collapse

Methods included from Node

#ancestors, #children, #children_nodes, #indent, #initialize, #level, #levels

Instance Method Details

#branchObject



82
83
84
85
# File 'lib/tree_graph.rb', line 82

def branch
  return '' unless parent
  is_last ? '└─' : '├─'
end

#tree_graphObject



78
79
80
# File 'lib/tree_graph.rb', line 78

def tree_graph
  levels.join("\n")
end