Skip to content

Instantly share code, notes, and snippets.

@fujimura
Created July 16, 2013 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fujimura/6005183 to your computer and use it in GitHub Desktop.
Save fujimura/6005183 to your computer and use it in GitHub Desktop.
class String
# Originally from http://stackoverflow.com/questions/1489183/colorized-ruby-output/11482430#11482430
def self.colorize color, code
define_method color do
"\e[#{code}m#{self}\e[0m"
end
end
colorize :red, 31
colorize :green, 32
colorize :yellow, 33
colorize :pink, 35
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment