summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>2011-04-28 03:43:14 +0100
committerKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>2011-04-28 03:43:14 +0100
commitd495723d6f0b400755c749e68c0a8b8d49570848 (patch)
tree4a98e87c70f0b4636c308590f30d2d41730edc16
parent0bd7550336df4d63bb957b742bb8caaa9f310355 (diff)
downloadpuppet-stdlib-d495723d6f0b400755c749e68c0a8b8d49570848.tar.gz
puppet-stdlib-d495723d6f0b400755c749e68c0a8b8d49570848.tar.bz2
First version. Simple is_array function to use within Puppet DSL.
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
-rw-r--r--is_array.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/is_array.rb b/is_array.rb
new file mode 100644
index 0000000..0b508fd
--- /dev/null
+++ b/is_array.rb
@@ -0,0 +1,21 @@
+#
+# is_array.rb
+#
+
+module Puppet::Parser::Functions
+ newfunction(:is_array, :type => :rvalue, :doc => <<-EOS
+ EOS
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "is_array(): Wrong number of arguments " +
+ "given (#{arguments.size} for 1)") if arguments.size < 1
+
+ type = arguments[0]
+
+ result = type.is_a?(Array)
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :