Sha256: 2d918fc74dca90f2dbf4110d5b83fc38332f559e6c79ef6357cd4c32f987ceb0
Contents?: true
Size: 743 Bytes
Versions: 1
Compression:
Stored size: 743 Bytes
Contents
require "tree_graph/version" module TreeGraph def tree_graph ([tree_graph_level] + children_for_tree_graph.map(&:tree_graph) ).join("\n") end def tree_graph_level tree_graph_indent + tree_graph_branch + label_for_tree_graph end def tree_graph_ancestors return [] unless parent_for_tree_graph parent_for_tree_graph.tree_graph_ancestors + [parent_for_tree_graph] end def tree_graph_branch return '' unless parent_for_tree_graph is_last_for_tree_graph ? '└─' : '├─' end def tree_graph_indent tree_graph_ancestors.map do |a| unless a.parent_for_tree_graph '' else a.is_last_for_tree_graph ? ' ' : '│ ' end end.join end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tree_graph-0.1.1 | lib/tree_graph.rb |