5 module Puppet::Parser::Functions
6 newfunction(:is_float, :type => :rvalue, :doc => <<-EOS
7 Returns true if the variable passed to this function is a float.
11 function_deprecation([:is_float, 'This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Float. There is further documentation for validate_legacy function in the README.'])
13 if (arguments.size != 1) then
14 raise(Puppet::ParseError, "is_float(): Wrong number of arguments given #{arguments.size} for 1")
19 # Only allow Numeric or String types
20 return false unless value.is_a?(Numeric) or value.is_a?(String)
22 if value != value.to_f.to_s and !value.is_a? Float then
31 # vim: set ts=2 sw=2 et :