Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/stockery.rb
Instance Method Summary collapse
- #colorize(text, color_code) ⇒ Object
- #green ⇒ Object
- #green_bg ⇒ Object
- #red ⇒ Object
- #red_bg ⇒ Object
Instance Method Details
#colorize(text, color_code) ⇒ Object
24 25 26 |
# File 'lib/stockery.rb', line 24 def colorize(text, color_code) "#{color_code}#{text}\e[0m" end |
#green ⇒ Object
20 |
# File 'lib/stockery.rb', line 20 def green; colorize(self, "\e[1m\e[32m"); end |
#green_bg ⇒ Object
22 |
# File 'lib/stockery.rb', line 22 def green_bg; colorize(self, "\e[31m\e[42m"); end |
#red ⇒ Object
19 |
# File 'lib/stockery.rb', line 19 def red; colorize(self, "\e[31m"); end |
#red_bg ⇒ Object
21 |
# File 'lib/stockery.rb', line 21 def red_bg; colorize(self, "\e[41m"); end |