Class: Nagios::Config
- Inherits:
-
Object
- Object
- Nagios::Config
- Defined in:
- lib/nagios/config.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #[](setting) ⇒ Object
- #[]=(field, value) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #parse! ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/nagios/config.rb', line 8 def initialize @settings = {} @options = OptionParser.new do || .on("-wWARNING", "--warning=WARNING", "Warning Threshold") do |x| @settings[:warning] = int_if_possible(x) end .on("-cCRITICAL", "--critical=CRITICAL", "Critical Threshold") do |x| @settings[:critical] = int_if_possible(x) end end end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/nagios/config.rb', line 6 def @options end |
Instance Method Details
#[](setting) ⇒ Object
24 25 26 |
# File 'lib/nagios/config.rb', line 24 def [](setting) @settings[setting] end |
#[]=(field, value) ⇒ Object
28 29 30 |
# File 'lib/nagios/config.rb', line 28 def []=(field, value) @settings[field] = vaule end |
#parse! ⇒ Object
32 33 34 |
# File 'lib/nagios/config.rb', line 32 def parse! @options.parse! end |