|
1 |
| -# Recursively merges two or more hashes together and returns the resulting hash. |
2 |
| -# For example: |
| 1 | +# @summary Recursively merges two or more hashes together and returns the resulting hash. |
3 | 2 | #
|
4 |
| -# $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } |
5 |
| -# $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } |
6 |
| -# $merged_hash = mysql::deepmerge($hash1, $hash2) |
7 |
| -# # The resulting hash is equivalent to: |
8 |
| -# # $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } |
| 3 | +# @example |
| 4 | +# $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } |
| 5 | +# $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } |
| 6 | +# $merged_hash = mysql_deepmerge($hash1, $hash2) |
| 7 | +# # The resulting hash is equivalent to: |
| 8 | +# # $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } |
| 9 | +# |
| 10 | +# - When there is a duplicate key that is a hash, they are recursively merged. |
| 11 | +# - When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." |
| 12 | +# - When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), the rightmost style will win. |
9 | 13 | #
|
10 |
| -# When there is a duplicate key that is a hash, they are recursively merged. |
11 |
| -# When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." |
12 |
| -# When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), |
13 |
| -# the rightmost style will win. |
14 | 14 | Puppet::Functions.create_function(:'mysql::deepmerge') do
|
15 | 15 | def deepmerge(*args)
|
16 | 16 | if args.length < 2
|
|
0 commit comments