class Spoom::FileTree::TreePrinter

An internal class used to print a FileTree

See `FileTree#print`

Attributes

tree[R]

Public Class Methods

new(tree:, out: $stdout, show_strictness: true, colors: true, indent_level: 0) click to toggle source
Calls superclass method Spoom::Printer::new
# File lib/spoom/file_tree.rb, line 130
def initialize(tree:, out: $stdout, show_strictness: true, colors: true, indent_level: 0)
  super(out: out, colors: colors, indent_level: indent_level)
  @tree = tree
  @show_strictness = show_strictness
end

Public Instance Methods

print_node(node) click to toggle source
print_nodes(nodes) click to toggle source
print_tree() click to toggle source

Private Instance Methods

node_strictness(node) click to toggle source
# File lib/spoom/file_tree.rb, line 176
def node_strictness(node)
  path = node.path
  prefix = tree.strip_prefix
  path = "#{prefix}/#{path}" if prefix
  Spoom::Sorbet::Sigils.file_strictness(path)
end
strictness_color(strictness) click to toggle source
# File lib/spoom/file_tree.rb, line 184
def strictness_color(strictness)
  case strictness
  when "false"
    :red
  when "true", "strict", "strong"
    :green
  else
    :uncolored
  end
end