Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/puppet-repl.rb
Overview
monkey patch in some color effects string methods
Instance Method Summary collapse
- #camel_case ⇒ Object
- #cyan ⇒ Object
- #fatal ⇒ Object
- #green ⇒ Object
- #info ⇒ Object
- #red ⇒ Object
- #warning ⇒ Object
- #yellow ⇒ Object
Instance Method Details
#camel_case ⇒ Object
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 |
#cyan ⇒ Object
14 |
# File 'lib/puppet-repl.rb', line 14 def cyan; "\033[36m#{self}\033[0m" end |
#fatal ⇒ Object
17 |
# File 'lib/puppet-repl.rb', line 17 def fatal; red end |
#green ⇒ Object
13 |
# File 'lib/puppet-repl.rb', line 13 def green; "\033[32m#{self}\033[0m" end |
#info ⇒ Object
18 |
# File 'lib/puppet-repl.rb', line 18 def info; green end |
#red ⇒ Object
12 |
# File 'lib/puppet-repl.rb', line 12 def red; "\033[31m#{self}\033[0m" end |
#warning ⇒ Object
16 |
# File 'lib/puppet-repl.rb', line 16 def warning; yellow end |
#yellow ⇒ Object
15 |
# File 'lib/puppet-repl.rb', line 15 def yellow; "\033[33m#{self}\033[0m" end |