Sha256: 9419fd1e5d0b18152634b045091faeac2976e667d672a93e70433bc538c2c6b0
Contents?: true
Size: 726 Bytes
Versions: 5
Compression:
Stored size: 726 Bytes
Contents
# frozen_string_literal: true require 'hashie/mash' module Chamber module Environmentable SECURE_KEY_TOKEN = /\A_secure_/ def with_environment(settings, parent_keys, hash_block, value_block) environment_hash = Hashie::Mash.new settings.each_pair do |key, value| environment_key = key.to_s.gsub(SECURE_KEY_TOKEN, '') environment_keys = parent_keys.dup.push(environment_key) if value.respond_to? :each_pair environment_hash.merge!(hash_block.call(key, value, environment_keys)) else environment_key = environment_keys.join('_').upcase environment_hash.merge!(value_block.call(key, value, environment_key)) end end environment_hash end end end
Version data entries
5 entries across 5 versions & 1 rubygems