Class: CobraCommander::Output::AsciiTree

Inherits:
Object
  • Object
show all
Defined in:
lib/cobra_commander/output/ascii_tree.rb

Overview

Prints the tree in a nice tree form

Constant Summary collapse

SPACE =
"    "
BAR =
"│   "
TEE =
"├── "
CORNER =
"└── "

Instance Method Summary collapse

Constructor Details

#initialize(component) ⇒ AsciiTree

Returns a new instance of AsciiTree.



14
15
16
# File 'lib/cobra_commander/output/ascii_tree.rb', line 14

def initialize(component)
  @component = component
end

Instance Method Details

#to_sObject



18
19
20
21
22
23
# File 'lib/cobra_commander/output/ascii_tree.rb', line 18

def to_s
  StringIO.new.tap do |io|
    io.puts @component.name
    list_dependencies(io, @component)
  end.string
end