Class: Watson::Printer

Inherits:
Object
  • Object
show all
Includes:
Watson
Defined in:
lib/watson/printer.rb

Overview

Printer class that handles all formatting and printing of parsed dir/file structure

Constant Summary

Constants included from Watson

BLUE, BOLD, CYAN, GRAY, GREEN, MAGENTA, RED, RESET, UNDERLINE, VERSION, WHITE, YELLOW

Instance Method Summary collapse

Methods included from Watson

check_less, debug_print

Constructor Details

#initialize(config) ⇒ Printer

Printer initialization method to setup necessary parameters, states, and vars



30
31
32
33
34
# File 'lib/watson/printer.rb', line 30

def initialize(config)
  # Identify method entry
  debug_print "#{self} : #{__method__}\n"
  @config = config
end

Instance Method Details

#build_formatterObject



45
46
47
# File 'lib/watson/printer.rb', line 45

def build_formatter
  @formatter ||= @config.output_format.new(@config)
end

#run(structure) ⇒ Object

Take parsed structure and print out in specified formatting



38
39
40
41
42
43
# File 'lib/watson/printer.rb', line 38

def run(structure)
  # Identify method entry
  debug_print "#{self} : #{__method__}\n"

  build_formatter.run(structure)
end