X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fdsa-puppet.git;a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fdeep_merge.rb;h=bf62576cfd6f9b0f16282b3ac11a842c69787265;hp=dd70c6178dcaca678c956618371bf5c5c32bb2d1;hb=30caaa85aed7015ca0d77216bff175eebd917eb7;hpb=6f656bd4265e3dab13b9af2bf96e9044322e9d8f diff --git a/3rdparty/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb b/3rdparty/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb index dd70c6178..bf62576cf 100644 --- a/3rdparty/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb +++ b/3rdparty/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb @@ -3,19 +3,23 @@ # module Puppet::Parser::Functions newfunction(:deep_merge, :type => :rvalue, :doc => <<-'DOC') do |args| - Recursively merges two or more hashes together and returns the resulting hash. + @summary + Recursively merges two or more hashes together and returns the resulting hash. - For example: + @example Example usage - $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 } } + $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } + $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } + $merged_hash = deep_merge($hash1, $hash2) - 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." + 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." + + @return [Hash] The merged hash DOC if args.length < 2