# File lib/configatron/root_store.rb, line 30 def __cow_path(path) start = @store.__cow_clone node = start branch = path.map do |key| node = node[key] node.__cow_clone end nodes = [start] + branch # [node1, node2, node3] with # [node2, node3, node4] and # ['key1', 'key2, 'key3'] nodes[0...-1].zip(nodes[1..-1], path) do |parent, child, key| # These are all cow_clones, so won't trigger a further cow # modification. parent[key] = child end @store = nodes.first nodes.last end