Class: Mutant::Color
- Inherits:
-
Object
- Object
- Mutant::Color
- Includes:
- Adamantium::Flat
- Defined in:
- lib/mutant/color.rb
Overview
Class to colorize strings
Constant Summary collapse
Instance Method Summary collapse
-
#format(text) ⇒ String
private
Format text with color.
-
#initialize(code) ⇒ undefined
constructor
private
Initialize color object.
Constructor Details
#initialize(code) ⇒ undefined
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.
Initialize color object
16 17 18 |
# File 'lib/mutant/color.rb', line 16 def initialize(code) @code = code end |
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
28 29 30 |
# File 'lib/mutant/color.rb', line 28 def format(text) "\e[#{@code}m#{text}\e[0m" end |