]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
(MODULES-444) - Real meat of the change
authorPeter Souter <p.souter@kainos.com>
Thu, 4 Dec 2014 14:34:25 +0000 (14:34 +0000)
committerPeter Souter <p.souter@kainos.com>
Thu, 4 Dec 2014 14:34:25 +0000 (14:34 +0000)
This is the core change, we now go through the array and add it to the first element, instead of just two arguments.

lib/puppet/parser/functions/concat.rb

index 8400f7b151735ba9a2f5fec9f317d1f2dec8329f..618e62d49239db54903a5e73fccf4a52230dfc16 100644 (file)
@@ -21,14 +21,18 @@ Would result in:
       "given (#{arguments.size} for < 2)") if arguments.size < 2
 
     a = arguments[0]
-    b = arguments[1]
 
     # Check that the first parameter is an array
     unless a.is_a?(Array)
       raise(Puppet::ParseError, 'concat(): Requires array to work with')
     end
 
-    result = a + Array(b)
+    result = a
+    arguments.shift
+
+    arguments.each do |x|
+      result = result + Array(x)
+    end
 
     return result
   end