5 module Puppet::Parser::Functions
6 newfunction(:size, :type => :rvalue, :doc => <<-EOS
7 Returns the number of elements in a string, an array or a hash
11 raise(Puppet::ParseError, "size(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size < 1
15 function_deprecation([:size, 'This method is going to be deprecated, please use the stdlib length function.'])
21 # Check whether your item is a numeric value or not ...
22 # This will take care about positive and/or negative numbers
23 # for both integer and floating-point values ...
25 # Please note that Puppet has no notion of hexadecimal
26 # nor octal numbers for its DSL at this point in time ...
30 raise(Puppet::ParseError, 'size(): Requires either string, array or hash to work with')
36 elsif item.is_a?(Array) || item.is_a?(Hash)
39 raise(Puppet::ParseError, 'size(): Unknown type given')
46 # vim: set ts=2 sw=2 et :