Sha256: 21b43975a2cb7be4286e2b5bacb7a04885e7ab2c8c513015bdb5af4e2b2a9382
Contents?: true
Size: 808 Bytes
Versions: 34
Compression:
Stored size: 808 Bytes
Contents
module RubyPitaya class ConfigSpecHelper def initialize @config_mock = {} end def [](key) split_key = key.split('.') @config_mock.dig(*split_key) end def auto_reload end def config_mock=(value) @config_mock = value.deep_symbolize_keys.stringify_keys end def config_core_override=(value) end def add(key, value) keys = key.split('.') add_hash = undig(*keys, value) @config_mock = merge_recursively(@config_mock, add_hash).deep_symbolize_keys.stringify_keys end private def undig(*keys, value) keys.empty? ? value : { keys.first=>undig(*keys.drop(1), value) } end def merge_recursively(a, b) a.merge(b) {|key, a_item, b_item| merge_recursively(a_item, b_item) } end end end
Version data entries
34 entries across 34 versions & 1 rubygems