Class: CqlRuby::ConsolePrinter

Inherits:
AbstractPrinter show all
Defined in:
lib/cql_ruby/console_printer.rb

Overview

Prints to console.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConsolePrinter

Returns a new instance of ConsolePrinter.



12
13
14
15
16
17
18
# File 'lib/cql_ruby/console_printer.rb', line 12

def initialize
  super

  @color_on = true
  @file_on = true
  @source_on = true
end

Instance Attribute Details

#color_on=(value) ⇒ Object (writeonly)

Sets the attribute color_on

Parameters:

  • value

    the value to set the attribute color_on to.



8
9
10
# File 'lib/cql_ruby/console_printer.rb', line 8

def color_on=(value)
  @color_on = value
end

#file_on=(value) ⇒ Object (writeonly)

Sets the attribute file_on

Parameters:

  • value

    the value to set the attribute file_on to.



9
10
11
# File 'lib/cql_ruby/console_printer.rb', line 9

def file_on=(value)
  @file_on = value
end

#source_on=(value) ⇒ Object (writeonly)

Sets the attribute source_on

Parameters:

  • value

    the value to set the attribute source_on to.



10
11
12
# File 'lib/cql_ruby/console_printer.rb', line 10

def source_on=(value)
  @source_on = value
end

Instance Method Details

Parameters:

  • crumb (Cqlruby::Crumb)


23
24
25
26
# File 'lib/cql_ruby/console_printer.rb', line 23

def print(crumb)
  puts "#{color(94)}#{crumb.file_name}#{decor_reset}:#{color(33)}#{crumb.line_no}#{decor_reset} #{color(93)}#{crumb.type}#{decor_reset}" if @file_on
  puts decorate_source_line(crumb) if @source_on
end