Class: Mutant::Color Private

Inherits:
Object
  • Object
show all
Includes:
Adamantium::Flat
Defined in:
lib/mutant/color.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class to colorize strings

Constant Summary collapse

NONE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Class.new(self) do

  # Format null color
  #
  # @param [String] text
  #
  # @return [String]
  #   the argument string
  def format(text)
    text
  end

private

  # Initialize null color
  #
  # @return [undefined]
  def initialize; end

end.new
RED =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Color.new(31)
GREEN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Color.new(32)
BLUE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Color.new(34)

Instance Method Summary collapse

Instance Method Details

#format(text) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Format text with color

Parameters:

  • text (String)

Returns:

  • (String)


13
14
15
# File 'lib/mutant/color.rb', line 13

def format(text)
  "\e[#{code}m#{text}\e[0m"
end