Class: String

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

Overview

monkey-patching string class to add colors.

Instance Method Summary collapse

Instance Method Details

#blackObject

1 is bold, 30 is black, 47 is white bg



10
11
12
# File 'lib/rs_api/patches/string.rb', line 10

def black
  "\033[1;30;47m#{self}\033[0m"
end

#blueObject



26
27
28
# File 'lib/rs_api/patches/string.rb', line 26

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

#cyanObject



34
35
36
# File 'lib/rs_api/patches/string.rb', line 34

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

#greenObject



18
19
20
# File 'lib/rs_api/patches/string.rb', line 18

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

#negativeObject



5
6
7
# File 'lib/rs_api/patches/string.rb', line 5

def negative
  "\033[7m#{self}\033[0m"
end

#purpleObject



30
31
32
# File 'lib/rs_api/patches/string.rb', line 30

def purple
  "\033[35m#{self}\033[0m"
end

#redObject



14
15
16
# File 'lib/rs_api/patches/string.rb', line 14

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

#whiteObject



38
39
40
# File 'lib/rs_api/patches/string.rb', line 38

def white
  "\033[37m#{self}\033[0m"
end

#yellowObject



22
23
24
# File 'lib/rs_api/patches/string.rb', line 22

def yellow
  "\033[33m#{self}\033[0m"
end