Module: Kernel

Includes:
Term::ANSIColour
Defined in:
lib/rcl/ext/ansicolour.rb

Instance Method Summary collapse

Methods included from Term::ANSIColour

attributes, colour, colour=

Instance Method Details

#orig_printObject



115
# File 'lib/rcl/ext/ansicolour.rb', line 115

alias_method :orig_print, :print

alias_method :orig_puts, :puts # XXX - still has issues passing a list



118
119
120
121
122
123
124
# File 'lib/rcl/ext/ansicolour.rb', line 118

def print(str)
  colours = Term::ANSIColour.colour
  attr    = Term::ANSIColour.attributes
  orig_print ( attr[colours[0]] == 0 ? str :
               colours.map{|c| "\e\[#{attr[c]}m"}.join + str + "\e\[#{attr['reset']}m"
             )
end