Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/lotu/helpers/string.rb

Overview

As saw in a russian comment by ZARATUSTR at: kpumuk.info/ruby-on-rails/colorizing-console-ruby-script-output/

Instance Method Summary collapse

Instance Method Details

#blueObject



9
# File 'lib/lotu/helpers/string.rb', line 9

def blue; colorize(self, "\e[1m\e[34m") end

#colorize(text, color_code) ⇒ Object



12
# File 'lib/lotu/helpers/string.rb', line 12

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

#dark_blueObject



10
# File 'lib/lotu/helpers/string.rb', line 10

def dark_blue; colorize(self, "\e[34m") end

#dark_greenObject



7
# File 'lib/lotu/helpers/string.rb', line 7

def dark_green; colorize(self, "\e[32m") end

#greenObject



6
# File 'lib/lotu/helpers/string.rb', line 6

def green; colorize(self, "\e[1m\e[32m") end

#purpleObject



11
# File 'lib/lotu/helpers/string.rb', line 11

def purple; colorize(self, "\e[1m\e[35m") end

#redObject



5
# File 'lib/lotu/helpers/string.rb', line 5

def red; colorize(self, "\e[1m\e[31m") end

#yellowObject



8
# File 'lib/lotu/helpers/string.rb', line 8

def yellow; colorize(self, "\e[1m\e[33m") end