Class: CqlRuby::ConsolePrinter
- Inherits:
-
AbstractPrinter
- Object
- AbstractPrinter
- CqlRuby::ConsolePrinter
- Defined in:
- lib/cql_ruby/console_printer.rb
Overview
Prints to console.
Instance Attribute Summary collapse
-
#color_on ⇒ Object
writeonly
Sets the attribute color_on.
-
#file_on ⇒ Object
writeonly
Sets the attribute file_on.
-
#source_on ⇒ Object
writeonly
Sets the attribute source_on.
Instance Method Summary collapse
-
#initialize ⇒ ConsolePrinter
constructor
A new instance of ConsolePrinter.
- #print(crumb) ⇒ Object
Constructor Details
#initialize ⇒ ConsolePrinter
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
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
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
10 11 12 |
# File 'lib/cql_ruby/console_printer.rb', line 10 def source_on=(value) @source_on = value end |
Instance Method Details
#print(crumb) ⇒ Object
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 |