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 collapse

DEBUG =

Debug printing for this class

false

Constants included from Watson

BLUE, BOLD, CYAN, GLOBAL_DEBUG_OFF, GLOBAL_DEBUG_ON, 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



33
34
35
36
37
# File 'lib/watson/printer.rb', line 33

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

Instance Method Details

#build_formatterObject



48
49
50
# File 'lib/watson/printer.rb', line 48

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

#run(structure) ⇒ Object

Take parsed structure and print out in specified formatting



41
42
43
44
45
46
# File 'lib/watson/printer.rb', line 41

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

  build_formatter.run(structure)
end