Skip to content

Instantly share code, notes, and snippets.

@leopolicastro
Created April 29, 2022 20:12
Show Gist options
  • Save leopolicastro/8e43ae022774a531c07c6ac041a078bf to your computer and use it in GitHub Desktop.
Save leopolicastro/8e43ae022774a531c07c6ac041a078bf to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
# Monkey Patch string class
class String
def black
"\033[30m#{self}\033[0m"
end
def red
"\033[31m#{self}\033[0m"
end
def green
"\033[32m#{self}\033[0m"
end
def brown
"\033[33m#{self}\033[0m"
end
def blue
"\033[34m#{self}\033[0m"
end
def magenta
"\033[35m#{self}\033[0m"
end
def cyan
"\033[36m#{self}\033[0m"
end
def gray
"\033[37m#{self}\033[0m"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment