Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/string.rb
Instance Method Summary collapse
- #bg_black ⇒ Object
- #bg_blue ⇒ Object
- #bg_brown ⇒ Object
- #bg_cyan ⇒ Object
- #bg_gray ⇒ Object
- #bg_green ⇒ Object
- #bg_magenta ⇒ Object
- #bg_red ⇒ Object
- #blue ⇒ Object
-
#colorize(color_code) ⇒ Object
colorization.
- #gray ⇒ Object
- #green ⇒ Object
- #light_blue ⇒ Object
- #pink ⇒ Object
- #red ⇒ Object
- #yellow ⇒ Object
Instance Method Details
#bg_black ⇒ Object
34 |
# File 'lib/string.rb', line 34 def bg_black; "\e[40m#{self}\e[0m" end |
#bg_blue ⇒ Object
38 |
# File 'lib/string.rb', line 38 def bg_blue; "\e[44m#{self}\e[0m" end |
#bg_brown ⇒ Object
37 |
# File 'lib/string.rb', line 37 def bg_brown; "\e[43m#{self}\e[0m" end |
#bg_cyan ⇒ Object
40 |
# File 'lib/string.rb', line 40 def bg_cyan; "\e[46m#{self}\e[0m" end |
#bg_gray ⇒ Object
41 |
# File 'lib/string.rb', line 41 def bg_gray; "\e[47m#{self}\e[0m" end |
#bg_green ⇒ Object
36 |
# File 'lib/string.rb', line 36 def bg_green; "\e[42m#{self}\e[0m" end |
#bg_magenta ⇒ Object
39 |
# File 'lib/string.rb', line 39 def bg_magenta; "\e[45m#{self}\e[0m" end |
#bg_red ⇒ Object
35 |
# File 'lib/string.rb', line 35 def bg_red; "\e[41m#{self}\e[0m" end |
#blue ⇒ Object
23 24 25 |
# File 'lib/string.rb', line 23 def blue colorize(34) end |
#colorize(color_code) ⇒ Object
colorization
3 4 5 |
# File 'lib/string.rb', line 3 def colorize(color_code) "\e[#{color_code}m#{self}\e[0m" end |
#gray ⇒ Object
19 20 21 |
# File 'lib/string.rb', line 19 def gray colorize(37) end |
#green ⇒ Object
11 12 13 |
# File 'lib/string.rb', line 11 def green colorize(32) end |
#light_blue ⇒ Object
31 32 33 |
# File 'lib/string.rb', line 31 def light_blue colorize(36) end |
#pink ⇒ Object
27 28 29 |
# File 'lib/string.rb', line 27 def pink colorize(35) end |
#red ⇒ Object
7 8 9 |
# File 'lib/string.rb', line 7 def red colorize(31) end |
#yellow ⇒ Object
15 16 17 |
# File 'lib/string.rb', line 15 def yellow colorize(33) end |