Class: Catlass::TermColor
- Inherits:
-
Object
- Object
- Catlass::TermColor
- Defined in:
- lib/catlass/logger.rb
Constant Summary collapse
- @@color =
true
Class Method Summary collapse
- .color=(color) ⇒ Object
- .colorize(num, msg) ⇒ Object
- .green(msg) ⇒ Object
- .red(msg) ⇒ Object
- .yellow(msg) ⇒ Object
Class Method Details
.color=(color) ⇒ Object
9 10 11 |
# File 'lib/catlass/logger.rb', line 9 def color=(color) @@color = color end |
.colorize(num, msg) ⇒ Object
25 26 27 |
# File 'lib/catlass/logger.rb', line 25 def colorize(num, msg) @@color ? "\e[#{num}m#{msg}\e[0m" : msg end |
.green(msg) ⇒ Object
13 14 15 |
# File 'lib/catlass/logger.rb', line 13 def green(msg) colorize 32, msg end |
.red(msg) ⇒ Object
21 22 23 |
# File 'lib/catlass/logger.rb', line 21 def red(msg) colorize 31, msg end |
.yellow(msg) ⇒ Object
17 18 19 |
# File 'lib/catlass/logger.rb', line 17 def yellow(msg) colorize 33, msg end |