module ColouredText
file: c32.rb
Public Instance Methods
bold()
click to toggle source
# File lib/c32.rb, line 43 def bold() "\e[1m#{self}\e[22m" end
colorize(color_code)
click to toggle source
# File lib/c32.rb, line 57 def colorize(color_code) "\e[#{color_code}m#{self}\e[0m" end
debug()
click to toggle source
# File lib/c32.rb, line 25 def debug() "debug: ".green + self.sub(/(?=\b[\S]+\: )/,"\n ")\ .sub(/(?<=\: )\S+/) {|x| x.green.bold }\ .sub(/\S+\:(?= )/) {|x| ("%s" % x).cyan.bold} + "\n\n" end
error()
click to toggle source
# File lib/c32.rb, line 37 def error() "error: ".red.bold + Time.now.strftime("%Y-%b-%d %H:%M").cyan + ' ' + self end
Also aliased as: err
highlight()
click to toggle source
# File lib/c32.rb, line 51 def highlight() self.brown.bold end
info()
click to toggle source
# File lib/c32.rb, line 47 def info() "info: ".bold + self end
warn()
click to toggle source
# File lib/c32.rb, line 31 def warn() "warning: ".brown + Time.now.strftime("%H:%M:%S").cyan + ' ' + self end
Also aliased as: warning