Sha256: 9f388c33df73e124e1a3b9f1f60c6d5bf57975ecdc14b095c510bbd0148430d0
Contents?: true
Size: 832 Bytes
Versions: 2
Compression:
Stored size: 832 Bytes
Contents
module WhoAmI module Function class LoadConfig include ProcParty def initialize(root) @root = root end def call Config.new(loaded_configuration) end private def loaded_configuration @loaded_configuration ||= if File.exist?(initializer_path) contents = YAML.load_file(initializer_path) deep_symbolize_hash(contents) else warn "WhoAmI configuration not found, using default" {} end end def initializer_path File.join(@root, "config", "who_am_i.yml") end def deep_symbolize_hash(obj) if obj.is_a?(Hash) obj.map { |k, v| [k.to_sym, deep_symbolize_hash(v)] }.to_h else obj end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
who_am_i-0.0.4 | lib/who_am_i/function/load_config.rb |
who_am_i-0.0.3 | lib/who_am_i/function/load_config.rb |