Class: String

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

Overview

monkey patch in some color effects string methods

Instance Method Summary collapse

Instance Method Details

#camel_caseObject



20
21
22
23
# File 'lib/puppet-repl.rb', line 20

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

#cyanObject



14
# File 'lib/puppet-repl.rb', line 14

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

#fatalObject



17
# File 'lib/puppet-repl.rb', line 17

def fatal;          red                      end

#greenObject



13
# File 'lib/puppet-repl.rb', line 13

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

#infoObject



18
# File 'lib/puppet-repl.rb', line 18

def info;           green                    end

#redObject



12
# File 'lib/puppet-repl.rb', line 12

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

#warningObject



16
# File 'lib/puppet-repl.rb', line 16

def warning;        yellow                   end

#yellowObject



15
# File 'lib/puppet-repl.rb', line 15

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