class Eye::Patch::Config

Public Class Methods

new(settings) click to toggle source
Calls superclass method
# File lib/eye/patch/config.rb, line 5
def initialize(settings)
  super()
  merge!(parse(settings))
end

Private Instance Methods

parse(settings) click to toggle source
# File lib/eye/patch/config.rb, line 12
def parse(settings)
  return @config if @config
  @config = {}

  parse_config(settings)
  parse_contacts(settings)

  @config
end
parse_config(settings) click to toggle source
# File lib/eye/patch/config.rb, line 22
def parse_config(settings)
  @config.merge!(settings[:config] || {})
end
parse_contacts(settings) click to toggle source
# File lib/eye/patch/config.rb, line 26
def parse_contacts(settings)
  @config[:contacts] = {}
  Array(settings[:notifications]).each do |notify|
    @config[notify[:type].to_sym] = notify[:config]
    @config[:contacts][notify[:name].to_s] = {
      name: notify[:name].to_s,
      type: notify[:type].to_sym,
      contact: notify[:contact].to_s,
      opts: {},
    }
  end
end