Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/string.rb

Instance Method Summary collapse

Instance Method Details

#bg_blackObject



34
# File 'lib/string.rb', line 34

def bg_black;       "\e[40m#{self}\e[0m" end

#bg_blueObject



38
# File 'lib/string.rb', line 38

def bg_blue;        "\e[44m#{self}\e[0m" end

#bg_brownObject



37
# File 'lib/string.rb', line 37

def bg_brown;       "\e[43m#{self}\e[0m" end

#bg_cyanObject



40
# File 'lib/string.rb', line 40

def bg_cyan;        "\e[46m#{self}\e[0m" end

#bg_grayObject



41
# File 'lib/string.rb', line 41

def bg_gray;        "\e[47m#{self}\e[0m" end

#bg_greenObject



36
# File 'lib/string.rb', line 36

def bg_green;       "\e[42m#{self}\e[0m" end

#bg_magentaObject



39
# File 'lib/string.rb', line 39

def bg_magenta;     "\e[45m#{self}\e[0m" end

#bg_redObject



35
# File 'lib/string.rb', line 35

def bg_red;         "\e[41m#{self}\e[0m" end

#blueObject



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

#grayObject



19
20
21
# File 'lib/string.rb', line 19

def gray 
  colorize(37)
end

#greenObject



11
12
13
# File 'lib/string.rb', line 11

def green
  colorize(32)
end

#light_blueObject



31
32
33
# File 'lib/string.rb', line 31

def light_blue
  colorize(36)
end

#pinkObject



27
28
29
# File 'lib/string.rb', line 27

def pink
  colorize(35)
end

#redObject



7
8
9
# File 'lib/string.rb', line 7

def red
  colorize(31)
end

#yellowObject



15
16
17
# File 'lib/string.rb', line 15

def yellow
  colorize(33)
end