4 module Puppet::Parser::Functions
5 newfunction(:empty, :type => :rvalue, :doc => <<-DOC
6 Returns true if the variable is empty.
8 Note: from Puppet 5.5.0, the compatible function with the same name in Puppet core
9 will be used instead of this function.
13 raise(Puppet::ParseError, "empty(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
16 unless value.is_a?(Array) || value.is_a?(Hash) || value.is_a?(String) || value.is_a?(Numeric)
17 raise(Puppet::ParseError, 'empty(): Requires either array, hash, string or integer to work with')
20 return false if value.is_a?(Numeric)
26 # vim: set ts=2 sw=2 et :