Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet-debugger/monkey_patches.rb

Overview

monkey patch in some color effects string methods

Instance Method Summary collapse

Instance Method Details

#blackObject



13
14
15
# File 'lib/puppet-debugger/monkey_patches.rb', line 13

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

#boldObject



9
10
11
# File 'lib/puppet-debugger/monkey_patches.rb', line 9

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

#camel_caseObject



41
42
43
44
45
# File 'lib/puppet-debugger/monkey_patches.rb', line 41

def camel_case
  return self if self !~ /_/ && self =~ /[A-Z]+.*/

  split('_').map(&:capitalize).join
end

#cyanObject



21
22
23
# File 'lib/puppet-debugger/monkey_patches.rb', line 21

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

#fatalObject



33
34
35
# File 'lib/puppet-debugger/monkey_patches.rb', line 33

def fatal
  red
end

#greenObject



17
18
19
# File 'lib/puppet-debugger/monkey_patches.rb', line 17

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

#infoObject



37
38
39
# File 'lib/puppet-debugger/monkey_patches.rb', line 37

def info
  green
end

#redObject



5
6
7
# File 'lib/puppet-debugger/monkey_patches.rb', line 5

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

#warningObject



29
30
31
# File 'lib/puppet-debugger/monkey_patches.rb', line 29

def warning
  yellow
end

#yellowObject



25
26
27
# File 'lib/puppet-debugger/monkey_patches.rb', line 25

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