Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/colorize.rb

Instance Method Summary collapse

Instance Method Details

#colorize(text, color_code) ⇒ Object

colorization



5
6
7
# File 'lib/colorize.rb', line 5

def colorize(text, color_code)
  "\e[#{color_code}m#{text}\e[0m"
end

#greenObject



13
14
15
# File 'lib/colorize.rb', line 13

def green
  colorize(self, 32)
end

#redObject



9
10
11
# File 'lib/colorize.rb', line 9

def red
  colorize(self, 31)
end