class Kojak::Printer::Colorized

Internal: Special version of thread-safe printer that additionally colorizes the output with one preconfigured color.

Attributes

color[RW]

Public: The String or Symbol with name of the assigned color.

Public Class Methods

new(out, color = :white) click to toggle source

Public: Constructor. Configures printer to write to given output in specified color.

out - The Stream to write data to. color - The String or Symbol with name of the color to use.

Returns nothing.

Calls superclass method Kojak::Printer::Basic::new
# File lib/kojak/printer/colorized.rb, line 17
def initialize(out, color = :white)
  super(out)

  @color   = color
  @rainbow = Rainbow.new
end

Public Instance Methods

write(s, *args) click to toggle source
Calls superclass method Kojak::Printer::Synchronized#write
# File lib/kojak/printer/colorized.rb, line 24
def write(s, *args)
  super(@rainbow.wrap(s.to_s).color(color), *args)
end