2011-04-29 05:37:50 +02:00
|
|
|
#
|
|
|
|
# is_hash.rb
|
|
|
|
#
|
|
|
|
|
|
|
|
module Puppet::Parser::Functions
|
2011-06-26 14:33:53 +02:00
|
|
|
newfunction(:is_hash, :type => :rvalue, :doc => <<-EOS
|
2011-07-30 00:09:30 +02:00
|
|
|
Returns true if the variable passed to this function is a hash.
|
2011-04-29 05:37:50 +02:00
|
|
|
EOS
|
|
|
|
) do |arguments|
|
|
|
|
|
|
|
|
raise(Puppet::ParseError, "is_hash(): Wrong number of arguments " +
|
2011-06-26 14:33:53 +02:00
|
|
|
"given (#{arguments.size} for 1)") if arguments.size != 1
|
2011-04-29 05:37:50 +02:00
|
|
|
|
|
|
|
type = arguments[0]
|
|
|
|
|
|
|
|
result = type.is_a?(Hash)
|
|
|
|
|
|
|
|
return result
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# vim: set ts=2 sw=2 et :
|