Class: String
- Defined in:
- modules/ipmi/lib/facter/ipmi.rb,
rake_modules/monkey_patch.rb
Overview
Monkey batch Yes/No to Boolean
Direct Known Subclasses
Instance Method Summary collapse
- #blue ⇒ Object
- #colorize(color_code) ⇒ Object
- #green ⇒ Object
- #red ⇒ Object
- #to_bool ⇒ Object
- #yellow ⇒ Object
Instance Method Details
#blue ⇒ Object
37 38 39 |
# File 'rake_modules/monkey_patch.rb', line 37 def blue colorize("\033[34m") end |
#colorize(color_code) ⇒ Object
21 22 23 |
# File 'rake_modules/monkey_patch.rb', line 21 def colorize(color_code) "#{color_code}#{self}\033[0m" end |
#green ⇒ Object
29 30 31 |
# File 'rake_modules/monkey_patch.rb', line 29 def green colorize("\033[32m") end |
#red ⇒ Object
25 26 27 |
# File 'rake_modules/monkey_patch.rb', line 25 def red colorize("\033[31m") end |
#to_bool ⇒ Object
6 7 8 9 |
# File 'modules/ipmi/lib/facter/ipmi.rb', line 6 def to_bool return true if :downcase == 'yes' return false if :downcase == 'no' end |
#yellow ⇒ Object
33 34 35 |
# File 'rake_modules/monkey_patch.rb', line 33 def yellow colorize("\033[33m") end |