Class: ZAWS::Helper::Output
- Inherits:
-
Object
- Object
- ZAWS::Helper::Output
- Defined in:
- lib/zaws/helper/output.rb
Class Method Summary collapse
- .binary_nagios_check(ok_condition, ok_msg, critical_msg, textout = nil) ⇒ Object
- .colorize(text, color_code) ⇒ Object
- .opt_exclusive(output, opt_arr) ⇒ Object
- .opt_minimum(output, min, opt_arr) ⇒ Object
- .opt_required(output, opt_arr) ⇒ Object
Class Method Details
.binary_nagios_check(ok_condition, ok_msg, critical_msg, textout = nil) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/zaws/helper/output.rb', line 34 def self.binary_nagios_check(ok_condition,ok_msg,critical_msg,textout=nil) if ok_condition textout.puts ok_msg if textout return 0 else textout.puts critical_msg if textout return 2 end end |
.colorize(text, color_code) ⇒ Object
16 17 18 |
# File 'lib/zaws/helper/output.rb', line 16 def self.colorize(text, color_code) "\e[#{color_code}m#{text}\e[0m" end |
.opt_exclusive(output, opt_arr) ⇒ Object
24 25 26 27 |
# File 'lib/zaws/helper/output.rb', line 24 def self.opt_exclusive(output,opt_arr) output.puts(" These options cannot be combined:") opt_arr.each { |opt| output.puts(" --#{opt}") } end |
.opt_minimum(output, min, opt_arr) ⇒ Object
29 30 31 32 |
# File 'lib/zaws/helper/output.rb', line 29 def self.opt_minimum(output,min,opt_arr) output.puts(" At mininum, #{min} of the following is required:") opt_arr.each { |opt| output.puts(" --#{opt}") } end |
.opt_required(output, opt_arr) ⇒ Object
20 21 22 |
# File 'lib/zaws/helper/output.rb', line 20 def self.opt_required(output,opt_arr) opt_arr.each { |opt| output.puts(" --#{opt} required!") } end |