5 # TODO(Krzysztof Wilczynski): Support for hashes would be nice too ...
7 module Puppet::Parser::Functions
8 newfunction(:size, :type => :rvalue, :doc => <<-EOS
9 Returns the number of elements in a string or array.
13 raise(Puppet::ParseError, "size(): Wrong number of arguments " +
14 "given (#{arguments.size} for 1)") if arguments.size < 1
22 # Check whether your item is a numeric value or not ...
23 # This will take care about positive and/or negative numbers
24 # for both integer and floating-point values ...
26 # Please note that Puppet has no notion of hexadecimal
27 # nor octal numbers for its DSL at this point in time ...
31 raise(Puppet::ParseError, 'size(): Requires either ' +
32 'string or array to work with')
38 elsif item.is_a?(Array)
41 raise(Puppet::ParseError, 'size(): Unknown type given')
48 # vim: set ts=2 sw=2 et :