Sha256: 2515d3009b06eda7fff1c212e2701f2b74292e451b368eddced25bb82f90368d
Contents?: true
Size: 738 Bytes
Versions: 8
Compression:
Stored size: 738 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 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) 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
8 entries across 8 versions & 1 rubygems