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



11
12
13
# File 'lib/puppet-debugger/monkey_patches.rb', line 11

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

#boldObject



7
8
9
# File 'lib/puppet-debugger/monkey_patches.rb', line 7

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

#camel_caseObject



39
40
41
42
# File 'lib/puppet-debugger/monkey_patches.rb', line 39

def camel_case
  return self if self !~ /_/ && self =~ /[A-Z]+.*/
  split('_').map(&:capitalize).join
end

#cyanObject



19
20
21
# File 'lib/puppet-debugger/monkey_patches.rb', line 19

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

#fatalObject



31
32
33
# File 'lib/puppet-debugger/monkey_patches.rb', line 31

def fatal
  red
end

#greenObject



15
16
17
# File 'lib/puppet-debugger/monkey_patches.rb', line 15

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

#infoObject



35
36
37
# File 'lib/puppet-debugger/monkey_patches.rb', line 35

def info
  green
end

#redObject



3
4
5
# File 'lib/puppet-debugger/monkey_patches.rb', line 3

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

#warningObject



27
28
29
# File 'lib/puppet-debugger/monkey_patches.rb', line 27

def warning
  yellow
end

#yellowObject



23
24
25
# File 'lib/puppet-debugger/monkey_patches.rb', line 23

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