Class: CollinsNotify::Options
- Inherits:
-
OptionParser
- Object
- OptionParser
- CollinsNotify::Options
- Includes:
- Collins::Util
- Defined in:
- lib/collins_notify/options.rb
Constant Summary collapse
- ETC_CONFIG =
"/etc/collins_notify.yaml"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.app_name ⇒ Object
11 12 13 |
# File 'lib/collins_notify/options.rb', line 11 def self.app_name File.basename($0) end |
.get_instance(config) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/collins_notify/options.rb', line 14 def self.get_instance config i = CollinsNotify::Options.new config i. = "Usage: #{app_name} --config=CONFIG [options]" i.separator "" i.instance_eval { setup } i end |
Instance Method Details
#parse!(argv = default_argv) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/collins_notify/options.rb', line 22 def parse! argv = default_argv res = super cfg_file = get_config_file if cfg_file then #config.config_file then yaml = YAML::load(File.open(cfg_file)) adapters = CollinsNotify::Notifier.adapters.keys yaml.each do |k,v| if adapters.include?(k.to_sym) then config.adapters[k.to_sym] = symbolize_hash(v) else try_configure k, v end end end res end |