Created
July 16, 2013 01:55
-
-
Save fujimura/6005183 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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