Initial version of merge function.
This commit is contained in:
parent
02a834f9da
commit
299f5a11fa
1 changed files with 20 additions and 0 deletions
20
util/lib/puppet/parser/functions/merge.rb
Normal file
20
util/lib/puppet/parser/functions/merge.rb
Normal 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
|
Loading…
Add table
Reference in a new issue