Skip to content

Commit

Permalink
(MODULES-444) - Real meat of the change
Browse files Browse the repository at this point in the history
This is the core change, we now go through the array and add it to the first element, instead of just two arguments.
  • Loading branch information
Peter Souter committed Dec 4, 2014
1 parent 594c2dd commit 84bd986
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/puppet/parser/functions/concat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ module Puppet::Parser::Functions
"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
Expand Down

0 comments on commit 84bd986

Please sign in to comment.