rambler-digital-solutions/Generamba

View on GitHub
lib/generamba/tools/string-colorize.rb

Summary

Maintainability
A
0 mins
Test Coverage
# Adds a number of methods for colorizing output strings
class String

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

  def red
    colorize(31)
  end

  def green
    colorize(32)
  end

  def yellow
    colorize(33)
  end

  def blue
    colorize(34)
  end
end