Module: NagiosHerald::Config
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#load(options = {}) ⇒ Object
Public: Load the configuration file for use globally.
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
8 9 10 |
# File 'lib/nagios-herald/config.rb', line 8 def config @config end |
Instance Method Details
#load(options = {}) ⇒ Object
Public: Load the configuration file for use globally.
options - The options hash built from command-line arguments.
Returns a hash of the parsed config file merged with the command line options.
15 16 17 18 19 20 21 22 |
# File 'lib/nagios-herald/config.rb', line 15 def load( = {}) abort("Config file not found #{['config_file']}") unless File.exists? ['config_file'] @config = AppConf.new @config.load(['config_file']) @config = @config.to_hash @config.merge!() # runtime options should override @config end |