Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/common.rb
Constant Summary collapse
- @@is_a_tty =
colorization
nil
Instance Method Summary collapse
- #blue ⇒ Object
- #brown ⇒ Object
- #colorize(color_code) ⇒ Object
- #green ⇒ Object
- #magenta ⇒ Object
- #red ⇒ Object
Instance Method Details
#blue ⇒ Object
35 36 37 |
# File 'lib/common.rb', line 35 def blue colorize(34) end |
#brown ⇒ Object
31 32 33 |
# File 'lib/common.rb', line 31 def brown colorize(33) end |
#colorize(color_code) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/common.rb', line 14 def colorize(color_code) @@is_a_tty = STDOUT.isatty() if @@is_a_tty == nil if @@is_a_tty then return "\e[#{color_code}m#{self}\e[0m" else return self end end |
#green ⇒ Object
27 28 29 |
# File 'lib/common.rb', line 27 def green colorize(32) end |
#magenta ⇒ Object
39 40 41 |
# File 'lib/common.rb', line 39 def magenta colorize(35) end |
#red ⇒ Object
23 24 25 |
# File 'lib/common.rb', line 23 def red colorize(31) end |