]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Docs: Improve example in merge function
authorJeff McCune <jeff@puppetlabs.com>
Tue, 16 Aug 2011 22:57:47 +0000 (15:57 -0700)
committernfagerlund <nick.fagerlund@gmail.com>
Thu, 18 Aug 2011 19:39:04 +0000 (12:39 -0700)
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.

lib/puppet/parser/functions/merge.rb

index d2dc0f9032e5f5855b1ae6e293188da104f07b1b..6ec085eb10d4c29422022b5f0b2a9394d3e28e69 100644 (file)
@@ -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