summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r--lib/puppet/parser/functions/concat.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/puppet/parser/functions/concat.rb b/lib/puppet/parser/functions/concat.rb
index c86aa00..6c86382 100644
--- a/lib/puppet/parser/functions/concat.rb
+++ b/lib/puppet/parser/functions/concat.rb
@@ -23,12 +23,16 @@ Would result in:
a = arguments[0]
b = arguments[1]
- # Check that both args are arrays.
- unless a.is_a?(Array) and b.is_a?(Array)
+ # 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.concat(b)
+ if b.is_a?(Array)
+ result = a.concat(b)
+ else
+ result = a << b
+ end
return result
end