Initial version of merge function.

This commit is contained in:
Timo Mkinen 2013-01-23 16:43:05 +02:00
parent 02a834f9da
commit 299f5a11fa

View file

@ -0,0 +1,20 @@
module Puppet::Parser::Functions
newfunction(:merge, :type => :rvalue) do |args|
if args.length < 2
raise Puppet::ParseError, ("merge(): wrong number of arguments (#{args.length}; must be at least 2)")
end
ret = []
args.each do |arg|
next if arg == ""
if arg.is_a?(Array)
ret.concat(arg)
else
ret.concat([arg])
end
end
ret
end
end