Sha256: e96cd494819f6c11b2baf8f3036c6acc8896a9460925d9726ae4eee2600ec957

Contents?: true

Size: 512 Bytes

Versions: 30

Compression:

Stored size: 512 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

30 entries across 30 versions & 2 rubygems

Version Path
midori.rb-0.9.0 lib/midori/core_ext/string.rb
midori.rb-0.8.0 lib/midori/core_ext/string.rb
midori.rb-0.7.1 lib/midori/core_ext/string.rb
midori.rb-0.7.0 lib/midori/core_ext/string.rb
midori.rb-0.6.0 lib/midori/core_ext/string.rb
midori.rb-0.5.4 lib/midori/core_ext/string.rb
midori.rb-0.5.3.1 lib/midori/core_ext/string.rb
midori.rb-0.5.3 lib/midori/core_ext/string.rb
midori.rb-0.5.2 lib/midori/core_ext/string.rb
midori.rb-0.5.1 lib/midori/core_ext/string.rb
midori.rb-0.5.0 lib/midori/core_ext/string.rb
midori.rb-0.4.4.1 lib/midori/core_ext/string.rb
midori.rb-0.4.4 lib/midori/core_ext/string.rb
midori.rb-0.4.3 lib/midori/core_ext/string.rb
em-midori-0.4.3 lib/midori/core_ext/string.rb
em-midori-0.4.2.1 lib/midori/core_ext/string.rb
em-midori-0.4.2 lib/midori/core_ext/string.rb
em-midori-0.4.1.1 lib/midori/core_ext/string.rb
em-midori-0.4.1 lib/midori/core_ext/string.rb
em-midori-0.4.0 lib/midori/core_ext/string.rb