Sha256: f221d86d917f8ee8c3193cd47a3033dc09b4ec1ba55bb458eee47c57f4b06b3b

Contents?: true

Size: 821 Bytes

Versions: 3

Compression:

Stored size: 821 Bytes

Contents

#  ======================================================
#  String Class
#  ======================================================
class String
  #  ====================================================
  #  Color String Methods
  #  ====================================================
  #  ----------------------------------------------------
  #  colorize method
  #
  #  Outputs a string in a formatted color.
  #  @param color_code The code to use
  #  @return Void
  #  ----------------------------------------------------
  def colorize(color_code)
    "\033[#{ color_code }m#{ self }\033[0m"
  end
  
  def blue; colorize(34) end
  def cyan; colorize(36) end
  def green; colorize(32) end
  def purple; colorize(35) end
  def red; colorize(31) end
  def white; colorize(37) end
  def yellow; colorize(33) end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cliutils-1.0.2 lib/cliutils/ext/String+Extensions.rb
cliutils-1.0.1 lib/cliutils/ext/String+Extensions.rb
cliutils-1.0.0 lib/cliutils/ext/String+Extensions.rb