Sha256: a78fc761e595ac28fcb413d24d7b81ea62fcc84c644bddd48882dc2ce9e66ccd

Contents?: true

Size: 532 Bytes

Versions: 5

Compression:

Stored size: 532 Bytes

Contents

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

  def red; colorize(self, "\e[1m\e[31m") end
  def green; colorize(self, "\e[1m\e[32m") end
  def dark_green; colorize(self, "\e[32m") end
  def yellow; colorize(self, "\e[1m\e[33m") end
  def blue; colorize(self, "\e[1m\e[34m") end
  def dark_blue; colorize(self, "\e[34m") end
  def purple; colorize(self, "\e[1m\e[35m") end
  def colorize(text, color_code) "#{color_code}#{text}\e[0m" end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lotu-0.1.22 lib/lotu/helpers/string.rb
lotu-0.1.21 lib/lotu/helpers/string.rb
lotu-0.1.20 lib/lotu/helpers/string.rb
lotu-0.1.19 lib/lotu/helpers/string.rb
lotu-0.1.18 lib/lotu/helpers/string.rb