Class: GemWhy::Formatters::TreeFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- GemWhy::Formatters::TreeFormatter
- Defined in:
- lib/gem_why/formatters/tree_formatter.rb
Overview
Formats tree visualization output
Instance Attribute Summary collapse
-
#tree_builder ⇒ Object
readonly
Returns the value of attribute tree_builder.
Attributes inherited from BaseFormatter
Instance Method Summary collapse
-
#format(gem_name, chains) ⇒ void
Formats and displays dependency tree.
-
#initialize(command, tree_builder) ⇒ TreeFormatter
constructor
A new instance of TreeFormatter.
Constructor Details
#initialize(command, tree_builder) ⇒ TreeFormatter
Returns a new instance of TreeFormatter.
11 12 13 14 |
# File 'lib/gem_why/formatters/tree_formatter.rb', line 11 def initialize(command, tree_builder) super(command) @tree_builder = tree_builder end |
Instance Attribute Details
#tree_builder ⇒ Object (readonly)
Returns the value of attribute tree_builder.
9 10 11 |
# File 'lib/gem_why/formatters/tree_formatter.rb', line 9 def tree_builder @tree_builder end |
Instance Method Details
#format(gem_name, chains) ⇒ void
This method returns an undefined value.
Formats and displays dependency tree
20 21 22 23 24 25 26 |
# File 'lib/gem_why/formatters/tree_formatter.rb', line 20 def format(gem_name, chains) return say "No gems depend on #{colorize(gem_name, :yellow)}" if chains.empty? say "Dependency tree for #{colorize(gem_name, :cyan)}:\n\n" print_dependency_tree(chains, gem_name) print_tree_summary(chains, gem_name) end |