Class: String

Inherits:
Object show all
Defined in:
modules/ipmi/lib/facter/ipmi.rb,
rake_modules/monkey_patch.rb

Overview

Monkey batch Yes/No to Boolean

Direct Known Subclasses

AlsoString

Instance Method Summary collapse

Instance Method Details

#blueObject



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

#greenObject



29
30
31
# File 'rake_modules/monkey_patch.rb', line 29

def green
  colorize("\033[32m")
end

#redObject



25
26
27
# File 'rake_modules/monkey_patch.rb', line 25

def red
  colorize("\033[31m")
end

#to_boolObject



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

#yellowObject



33
34
35
# File 'rake_modules/monkey_patch.rb', line 33

def yellow
  colorize("\033[33m")
end