util: Added to_array() function.

This commit is contained in:
Timo Makinen 2014-03-07 14:54:23 +02:00
parent e163fd4fa3
commit c8d7fb66b7

View file

@ -0,0 +1,13 @@
module Puppet::Parser::Functions
newfunction(:to_array, :type => :rvalue) do |args|
if args.length != 1
raise Puppet::ParseError, ("to_array(): wrong number of arguments (#{args.length}; must be 1)")
end
if args[0].is_a?(Array) then
args[0]
else
[ args[0] ]
end
end
end