diff options
author | Jeff McCune <jeff@puppetlabs.com> | 2011-08-16 15:57:47 -0700 |
---|---|---|
committer | nfagerlund <nick.fagerlund@gmail.com> | 2011-08-18 12:39:04 -0700 |
commit | 27c3b644b00bb2eca0cb819c55d7d348a1caa01b (patch) | |
tree | 384aa7122d184f8f5553f68feb7a4f9df606649a /lib/puppet/parser | |
parent | ad5316f561475157e425a7fddf1365e8e89b2b9d (diff) | |
download | puppet-stdlib-27c3b644b00bb2eca0cb819c55d7d348a1caa01b.tar.gz puppet-stdlib-27c3b644b00bb2eca0cb819c55d7d348a1caa01b.tar.bz2 |
Docs: Improve example in merge function
This commit replaces the example in the merge function with a much clearer
one. It also mentions that the rightmost value wins in the event of duplicated
hash keys.
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r-- | lib/puppet/parser/functions/merge.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/puppet/parser/functions/merge.rb b/lib/puppet/parser/functions/merge.rb index d2dc0f9..6ec085e 100644 --- a/lib/puppet/parser/functions/merge.rb +++ b/lib/puppet/parser/functions/merge.rb @@ -4,10 +4,13 @@ module Puppet::Parser::Functions For example: - $hash1 = {'one' => 1, 'two', => 2} - $hash1 = {'two' => 2, 'three', => 2} - $merged_hash = merge($hash1, $hash2) - # merged_hash = {'one' => 1, 'two' => 2, 'three' => 2} + $hash1 = {'one' => 1, 'two', => 2} + $hash2 = {'two' => 'dos', 'three', => 'tres'} + $merged_hash = merge($hash1, $hash2) + # The resulting hash is equivalent to: + # $merged_hash = {'one' => 1, 'two' => 'dos', 'three' => 'tres'} + + When there is a duplicate key, the key in the rightmost hash will "win." ENDHEREDOC |