summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Souter <p.souter@kainos.com>2014-12-04 14:34:25 +0000
committerPeter Souter <p.souter@kainos.com>2014-12-04 14:34:25 +0000
commit84bd98645f248a1dc3e0ed791e3af6f2ba9996fa (patch)
treeae48f9dbcb5a97bee2255315f698fd66023cd1b6
parent594c2dd38dc35a4f458ce511be9b7dd875915b44 (diff)
downloadpuppet-stdlib-84bd98645f248a1dc3e0ed791e3af6f2ba9996fa.tar.gz
puppet-stdlib-84bd98645f248a1dc3e0ed791e3af6f2ba9996fa.tar.bz2
(MODULES-444) - Real meat of the change
This is the core change, we now go through the array and add it to the first element, instead of just two arguments.
-rw-r--r--lib/puppet/parser/functions/concat.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/puppet/parser/functions/concat.rb b/lib/puppet/parser/functions/concat.rb
index 8400f7b..618e62d 100644
--- a/lib/puppet/parser/functions/concat.rb
+++ b/lib/puppet/parser/functions/concat.rb
@@ -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