Class: CobraCommander::CLI::Output::AsciiTree
- Inherits:
-
Object
- Object
- CobraCommander::CLI::Output::AsciiTree
- Defined in:
- lib/cobra_commander/cli/output/ascii_tree.rb
Overview
Prints the tree in a nice tree form
Constant Summary collapse
- SPACE =
" "- BAR =
"│ "- TEE =
"├── "- CORNER =
"└── "
Instance Method Summary collapse
-
#initialize(components) ⇒ AsciiTree
constructor
A new instance of AsciiTree.
- #to_s ⇒ Object
Constructor Details
#initialize(components) ⇒ AsciiTree
14 15 16 |
# File 'lib/cobra_commander/cli/output/ascii_tree.rb', line 14 def initialize(components) @components = components.sort_by(&:name) end |
Instance Method Details
#to_s ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/cobra_commander/cli/output/ascii_tree.rb', line 18 def to_s StringIO.new.tap do |io| @components.each do |component| io.puts component.name list_dependencies(io, component) end end.string end |