README.md in deep_merge-1.1.1 vs README.md in deep_merge-1.2.0
- old
+ new
@@ -37,10 +37,12 @@
Set to string value to run "Array::join" then "String::split" against all arrays
:merge_hash_arrays DEFAULT: false
Set to true to merge hashes within arrays
:extend_existing_arrays DEFAULT: false
Set to true to extend existing arrays, instead of overwriting them
+ :merge_nil_values DEFAULT: false
+ Set to true to merge nil hash values, overwriting a possibly non-nil value
:merge_debug DEFAULT: false
Set to true to get console output of merge process for debugging
Selected Options Details
------------------------
@@ -96,9 +98,18 @@
source = { "property" => "4" }
dest = { "property" => ["1", "2", "3"] }
dest.deep_merge!(source, {:extend_existing_arrays => true})
Results: {"property" => ["1", "2", "3", "4"]}
+
+**:merge_nil_values**
+
+The purpose of this option is to allow nil hash values to be merged. The prior behavior was to discard nil hash values and remains the default if not specified.
+
+ source = {"item" => nil}
+ dest = {"item" => "existing"}
+ dest.deep_merge!(source, {:merge_nil_values => true})
+ Results: {"item" => nil}
There are many tests for this library - and you can learn more about the features and usages of deep_merge! by just browsing the test examples.
Using deep_merge in Rails
=========================