Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/constancy.rb
Overview
monkeypatch String for colors
Instance Method Summary collapse
- #blue ⇒ Object
- #bold ⇒ Object
- #colorize(s, e = 0) ⇒ Object
- #cyan ⇒ Object
- #gray ⇒ Object
- #green ⇒ Object
- #magenta ⇒ Object
- #red ⇒ Object
Instance Method Details
#blue ⇒ Object
53 54 55 |
# File 'lib/constancy.rb', line 53 def blue colorize(34) end |
#bold ⇒ Object
69 70 71 |
# File 'lib/constancy.rb', line 69 def bold colorize(1,22) end |
#colorize(s, e = 0) ⇒ Object
41 42 43 |
# File 'lib/constancy.rb', line 41 def colorize(s,e=0) Constancy.config.color? ? "\e[#{s}m#{self}\e[#{e}m" : self end |
#cyan ⇒ Object
61 62 63 |
# File 'lib/constancy.rb', line 61 def cyan colorize(36) end |
#gray ⇒ Object
65 66 67 |
# File 'lib/constancy.rb', line 65 def gray colorize(37) end |
#green ⇒ Object
49 50 51 |
# File 'lib/constancy.rb', line 49 def green colorize(32) end |
#magenta ⇒ Object
57 58 59 |
# File 'lib/constancy.rb', line 57 def magenta colorize(35) end |
#red ⇒ Object
45 46 47 |
# File 'lib/constancy.rb', line 45 def red colorize(31) end |