From 0b5f9681fa46270219e3005674bfdb8462bf08dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20M=E4kinen?= Date: Tue, 7 May 2013 22:19:50 +0300 Subject: [PATCH] Added function that checks if given value is array. --- util/lib/puppet/parser/functions/is_array.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 util/lib/puppet/parser/functions/is_array.rb diff --git a/util/lib/puppet/parser/functions/is_array.rb b/util/lib/puppet/parser/functions/is_array.rb new file mode 100644 index 0000000..7892b1d --- /dev/null +++ b/util/lib/puppet/parser/functions/is_array.rb @@ -0,0 +1,8 @@ +module Puppet::Parser::Functions + newfunction(:is_array, :type => :rvalue) do |args| + if args.length != 1 + raise Puppet::ParseError, ("is_array(): wrong number of arguments (#{args.length}; must be 2)") + end + args[0].is_a?(Array) + end +end