Sha256: 29e4bdadc28eb8e217bc7d0cc5683ad6eb888a0ace9598bfc62bb9594238685c

Contents?: true

Size: 514 Bytes

Versions: 2

Compression:

Stored size: 514 Bytes

Contents

##
# Meta-programming String for Syntactic Sugars
class String
  # @param [Integer] color_code ANSI color code
  # @return [String] colored string
  def colorize(color_code)
    "\e[#{color_code}m#{self}\e[0m"
  end

  # color the string with red color
  def red
    colorize(31)
  end

  # color the string with green color
  def green
    colorize(32)
  end
  
  # color the string with yellow color
  def yellow
    colorize(33)
  end

  # color the string with blue color
  def blue
    colorize(34)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-midori-0.1.8 lib/midori/core_ext/string.rb
em-midori-0.1.7.1 lib/midori/core_ext/string.rb