summaryrefslogtreecommitdiff
path: root/README.markdown
diff options
context:
space:
mode:
authorDavid Schmitt <david.schmitt@puppet.com>2016-07-19 12:16:53 +0100
committerGitHub <noreply@github.com>2016-07-19 12:16:53 +0100
commit160a3571a40c51a17a2109fc876e160e6eab6e14 (patch)
tree40b1acf1723d44f1c795d0b68767c2f90620b716 /README.markdown
parent29e5d3c2decbb3a955487ddca6f19b2874482e08 (diff)
parent41a46b67aed703cd9311aa0c4e4b18ff81a75fa8 (diff)
Merge pull request #622 from tphoney/modules-3306
(MODULES-3306) document deep_merge
Diffstat (limited to 'README.markdown')
-rw-r--r--README.markdown13
1 files changed, 13 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown
index 45b4482..158f55b 100644
--- a/README.markdown
+++ b/README.markdown
@@ -245,6 +245,19 @@ Converts a given integer or base 10 string representing an integer to a specifie
If called with only an array, it counts the number of elements that are **not** nil/undef. If called with a second argument, counts the number of elements in an array that matches the second argument. *Type*: rvalue.
+#### `deep_merge`
+
+Recursively merges two or more hashes together and returns the resulting hash.
+ $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
+ $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
+ $merged_hash = deep_merge($hash1, $hash2)
+
+The resulting hash is equivalent to:
+ $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } }
+
+When there is a duplicate key that is a hash, they are recursively merged. When there is a duplicate key that is not a hash, the key in the rightmost hash will "win.".
+*Type*: rvalue, rvalue.
+
#### `defined_with_params`
Takes a resource reference and an optional hash of attributes. Returns 'true' if a resource with the specified attributes has already been added to the catalog. Returns 'false' otherwise.