Sha256: b7f1289423d344cbc564a859c03498e9ff0fa14bc67fbb18c49f028190ec677d
Contents?: true
Size: 745 Bytes
Versions: 3
Compression:
Stored size: 745 Bytes
Contents
# frozen_string_literal: true class Eye::Patch::Config < Hash def initialize(settings) super() merge!(parse(settings)) end private def parse(settings) return @config if @config @config = {} parse_config(settings) parse_contacts(settings) @config end def parse_config(settings) @config.merge!(settings[:config] || {}) end 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 end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
eye-patch-1.1.0 | lib/eye/patch/config.rb |
eye-patch-1.0.1 | lib/eye/patch/config.rb |
eye-patch-1.0.0 | lib/eye/patch/config.rb |