Sha256: 9401ff38c7e5bc08d8963cd3a9743a0e29efde78c2a9a04da728e08011a0a2b1
Contents?: true
Size: 644 Bytes
Versions: 20
Compression:
Stored size: 644 Bytes
Contents
class Hashr < Hash module EnvDefaults attr_writer :env_namespace def env_namespace=(env_namespace) @env_namespace = [env_namespace.upcase] end def env_namespace @env_namespace ||= [] end def definition deep_enverize(super) end protected def deep_enverize(hash, nesting = env_namespace) hash.each do |key, value| nesting << key.to_s.upcase hash[key] = case value when Hash deep_enverize(value, nesting) else ENV.fetch(nesting.join('_'), value) end.tap { nesting.pop } end end end end
Version data entries
20 entries across 20 versions & 1 rubygems