Class: String

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

Instance Method Summary collapse

Instance Method Details

#bg_blackObject



40
41
42
# File 'lib/tabry/core_ext/string/colors.rb', line 40

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

#bg_blueObject



56
57
58
# File 'lib/tabry/core_ext/string/colors.rb', line 56

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

#bg_brownObject



52
53
54
# File 'lib/tabry/core_ext/string/colors.rb', line 52

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

#bg_cyanObject



64
65
66
# File 'lib/tabry/core_ext/string/colors.rb', line 64

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

#bg_grayObject



68
69
70
# File 'lib/tabry/core_ext/string/colors.rb', line 68

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

#bg_greenObject



48
49
50
# File 'lib/tabry/core_ext/string/colors.rb', line 48

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

#bg_magentaObject



60
61
62
# File 'lib/tabry/core_ext/string/colors.rb', line 60

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

#bg_redObject



44
45
46
# File 'lib/tabry/core_ext/string/colors.rb', line 44

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

#blackObject



8
9
10
# File 'lib/tabry/core_ext/string/colors.rb', line 8

def black
  "\e[30m#{self}\e[0m"
end


84
85
86
# File 'lib/tabry/core_ext/string/colors.rb', line 84

def blink
  "\e[5m#{self}\e[25m"
end

#blueObject



24
25
26
# File 'lib/tabry/core_ext/string/colors.rb', line 24

def blue
  "\e[34m#{self}\e[0m"
end

#boldObject



72
73
74
# File 'lib/tabry/core_ext/string/colors.rb', line 72

def bold
  "\e[1m#{self}\e[22m"
end

#brownObject



20
21
22
# File 'lib/tabry/core_ext/string/colors.rb', line 20

def brown
  "\e[33m#{self}\e[0m"
end

#cyanObject



32
33
34
# File 'lib/tabry/core_ext/string/colors.rb', line 32

def cyan
  "\e[36m#{self}\e[0m"
end

#decolorizeObject



4
5
6
# File 'lib/tabry/core_ext/string/colors.rb', line 4

def decolorize
  gsub(/\e\[(\d+)(;\d+)*m/, "")
end

#grayObject



36
37
38
# File 'lib/tabry/core_ext/string/colors.rb', line 36

def gray
  "\e[37m#{self}\e[0m"
end

#greenObject



16
17
18
# File 'lib/tabry/core_ext/string/colors.rb', line 16

def green
  "\e[32m#{self}\e[0m"
end

#italicObject



76
77
78
# File 'lib/tabry/core_ext/string/colors.rb', line 76

def italic
  "\e[3m#{self}\e[23m"
end

#magentaObject



28
29
30
# File 'lib/tabry/core_ext/string/colors.rb', line 28

def magenta
  "\e[35m#{self}\e[0m"
end

#redObject



12
13
14
# File 'lib/tabry/core_ext/string/colors.rb', line 12

def red
  "\e[31m#{self}\e[0m"
end

#reverse_colorObject



88
89
90
# File 'lib/tabry/core_ext/string/colors.rb', line 88

def reverse_color
  "\e[7m#{self}\e[27m"
end

#underlineObject



80
81
82
# File 'lib/tabry/core_ext/string/colors.rb', line 80

def underline
  "\e[4m#{self}\e[24m"
end