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%2Fconcat.rb;h=d3c2e24336bd2934c0bebe50b865a9334e8de5bd;hp=136f402a4c0e9ed5d5019fd073b818a1be8a0987;hb=30caaa85aed7015ca0d77216bff175eebd917eb7;hpb=6f656bd4265e3dab13b9af2bf96e9044322e9d8f diff --git a/3rdparty/modules/stdlib/lib/puppet/parser/functions/concat.rb b/3rdparty/modules/stdlib/lib/puppet/parser/functions/concat.rb index 136f402a4..d3c2e2433 100644 --- a/3rdparty/modules/stdlib/lib/puppet/parser/functions/concat.rb +++ b/3rdparty/modules/stdlib/lib/puppet/parser/functions/concat.rb @@ -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|