puppetlabs-stdlib/empty.rb
Krzysztof Wilczynski 551f4ce95b Moved to unless from if not and removed TODO.
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
2011-04-30 00:58:37 +01:00

27 lines
564 B
Ruby

#
# empty.rb
#
module Puppet::Parser::Functions
newfunction(:empty, :type => :rvalue, :doc => <<-EOS
EOS
) do |arguments|
raise(Puppet::ParseError, "empty(): Wrong number of arguments " +
"given (#{arguments.size} for 1)") if arguments.size < 1
value = arguments[0]
klass = value.class
unless [Array, Hash, String].include?(klass)
raise(Puppet::ParseError, 'empty(): Requires either ' +
'array, hash or string to work with')
end
result = value.empty?
return result
end
end
# vim: set ts=2 sw=2 et :