Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/hardhat/ext/string.rb
Instance Method Summary collapse
- #black ⇒ Object
- #blue ⇒ Object
- #colorize(color_code) ⇒ Object
- #cyan ⇒ Object
- #green ⇒ Object
- #magenta ⇒ Object
- #red ⇒ Object
- #white ⇒ Object
- #yellow ⇒ Object
Instance Method Details
#black ⇒ Object
7 |
# File 'lib/hardhat/ext/string.rb', line 7 def black; self.colorize(30); end |
#blue ⇒ Object
11 |
# File 'lib/hardhat/ext/string.rb', line 11 def blue; self.colorize(34); end |
#colorize(color_code) ⇒ Object
3 4 5 |
# File 'lib/hardhat/ext/string.rb', line 3 def colorize(color_code) "\e[#{color_code}m#{self}\e[0m" end |
#cyan ⇒ Object
13 |
# File 'lib/hardhat/ext/string.rb', line 13 def cyan; self.colorize(36); end |
#green ⇒ Object
9 |
# File 'lib/hardhat/ext/string.rb', line 9 def green; self.colorize(32); end |
#magenta ⇒ Object
12 |
# File 'lib/hardhat/ext/string.rb', line 12 def magenta; self.colorize(35); end |
#red ⇒ Object
8 |
# File 'lib/hardhat/ext/string.rb', line 8 def red; self.colorize(31); end |
#white ⇒ Object
14 |
# File 'lib/hardhat/ext/string.rb', line 14 def white; self.colorize(37); end |
#yellow ⇒ Object
10 |
# File 'lib/hardhat/ext/string.rb', line 10 def yellow; self.colorize(33); end |