util: Added to_array() function.
This commit is contained in:
parent
e163fd4fa3
commit
c8d7fb66b7
1 changed files with 13 additions and 0 deletions
13
util/lib/puppet/parser/functions/to_array.rb
Normal file
13
util/lib/puppet/parser/functions/to_array.rb
Normal 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
|
||||||
|
|
Loading…
Add table
Reference in a new issue