Commit c40e0404 authored by Jérémie Gaidamour's avatar Jérémie Gaidamour
Browse files

[dev] Fixed deep_merge

parent e8ffd86d
...@@ -88,7 +88,7 @@ class ::Hash ...@@ -88,7 +88,7 @@ class ::Hash
key = key.to_sym if key_ab.is_a?(Symbol) key = key.to_sym if key_ab.is_a?(Symbol)
# For duplicate entries, the value of PREFIX-x is kept. # For duplicate entries, the value of PREFIX-x is kept.
self[key] = deep_merge_entries(value_ab, self[key]).clone self[key] = deep_merge_entries(deep_copy(value_ab), self[key]).clone
} }
else else
...@@ -101,7 +101,7 @@ class ::Hash ...@@ -101,7 +101,7 @@ class ::Hash
next if not x or x.to_i < a next if not x or x.to_i < a
# For duplicate entries, the value of PREFIX-x is kept. # For duplicate entries, the value of PREFIX-x is kept.
self[key_x] = deep_merge_entries(value_ab, value_x).clone self[key_x] = deep_merge_entries(deep_copy(value_ab), value_x).clone
} }
end end
...@@ -148,4 +148,8 @@ class ::Hash ...@@ -148,4 +148,8 @@ class ::Hash
} }
end end
def deep_copy(o)
Marshal.load(Marshal.dump(o))
end
end end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment