Sha256: be87f28286923a09860820092caf6eb2cda7e5931e63cc52681ee0acbda425fc

Contents?: true

Size: 544 Bytes

Versions: 104

Compression:

Stored size: 544 Bytes

Contents

class String
  module Colors
    RED    = 31
    GREEN  = 32
    YELLOW = 33
    BLUE   = 34
    PURPLE = 35
    CYAN   = 36
    GREY   = 37
  end

  def red
    colorize(Colors::RED)
  end

  def green
    colorize(Colors::GREEN)
  end

  def yellow
    colorize(Colors::YELLOW)
  end

  def blue
    colorize(Colors::BLUE)
  end

  def purple
    colorize(Colors::PURPLE)
  end

  def cyan
    colorize(Colors::CYAN)
  end

  def grey
    colorize(Colors::GREY)
  end

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

Version data entries

104 entries across 104 versions & 1 rubygems

Version Path
kuber_kit-1.3.8 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.3.7 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.1.8 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.3.6 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.1.7 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.3.5 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.3.4 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.1.6 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.3.3 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.3.2 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.1.5 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.3.1 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.3.0 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.1.4 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.2.7 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.2.6 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.2.5 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.2.4 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.2.2 lib/kuber_kit/extensions/colored_string.rb
kuber_kit-1.1.2 lib/kuber_kit/extensions/colored_string.rb