Class: Mutant::Color

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

Overview

Class to colorize strings

Constant Summary collapse

RED =
Color.new(31)
GREEN =
Color.new(32)
BLUE =
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)


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

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