Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / parser / functions / concat.rb
index 136f402..d3c2e24 100644 (file)
@@ -3,19 +3,23 @@
 #
 module Puppet::Parser::Functions
   newfunction(:concat, :type => :rvalue, :doc => <<-DOC
-    Appends the contents of multiple arrays into array 1.
+    @summary
+      Appends the contents of multiple arrays into array 1.
 
-    *Example:*
+    @example Example usage
 
-        concat(['1','2','3'],['4','5','6'],['7','8','9'])
+      concat(['1','2','3'],'4') returns ['1','2','3','4']
+      concat(['1','2','3'],'4',['5','6','7']) returns ['1','2','3','4','5','6','7']
 
-    Would result in:
+    > *Note:*
+      Since Puppet 4.0, you can use the `+`` operator for concatenation of arrays and
+      merge of hashes, and the `<<`` operator for appending:
 
-      ['1','2','3','4','5','6','7','8','9']
+    `['1','2','3'] + ['4','5','6'] + ['7','8','9']` returns `['1','2','3','4','5','6','7','8','9']`
+    `[1, 2, 3] << 4` returns `[1, 2, 3, 4]`
+    `[1, 2, 3] << [4, 5]` returns `[1, 2, 3, [4, 5]]`
 
-    Note: Since Puppet 4.0 concatenation of arrays and hashes can be done with the + operator.
-
-      ['1','2','3'] + ['4','5','6'] + ['7','8','9']
+    @return [Array] The single concatenated array
   DOC
              ) do |arguments|