]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
(PUP-1195) Rephrase documentation for is_integer and is_numeric
authorHenrik Lindberg <henrik.lindberg@cloudsmith.com>
Thu, 23 Jan 2014 23:22:09 +0000 (00:22 +0100)
committerHenrik Lindberg <henrik.lindberg@cloudsmith.com>
Thu, 23 Jan 2014 23:22:09 +0000 (00:22 +0100)
The documentation contained references to future decisions about
functionality.
Text rephrased for clarity.

lib/puppet/parser/functions/is_integer.rb
lib/puppet/parser/functions/is_numeric.rb

index 3c4874e0b40015dc9b11db71e56cb89f29698ec4..c03d28df9202b602d9c616eafd3a66b26af19eb5 100644 (file)
@@ -4,10 +4,12 @@
 
 module Puppet::Parser::Functions
   newfunction(:is_integer, :type => :rvalue, :doc => <<-EOS
-Returns true if the variable passed to this function is an integer.
+Returns true if the variable passed to this function is an Integer or
+a decimal (base 10) integer in String form. The string may
+start with a '-' (minus). A value of '0' is allowed, but a leading '0' digit may not
+be followed by other digits as this indicates that the value is octal (base 8).
 
-If the variable is a string it has to be in the correct format of an
-integer.
+If given any other argument `false` is returned.
     EOS
   ) do |arguments|
 
index f2417f3b10dab454aa474fb96286549e6e7631c3..e7e1d2a746fae1c66af50248f3b57a67a79c15d6 100644 (file)
@@ -4,13 +4,15 @@
 
 module Puppet::Parser::Functions
   newfunction(:is_numeric, :type => :rvalue, :doc => <<-EOS
-Returns true if the variable passed to this function is a number.
+Returns true if the given argument is a Numeric (Integer or Float),
+or a String containing either a valid integer in decimal base 10 form, or
+a valid floating point string representation.
 
-The function recognizes only integer and float but not hex or octal
-numbers (for now) until a decision is made how to handle these types.
+The function recognizes only decimal (base 10) integers and float but not
+integers in hex (base 16) or octal (base 8) form.
 
-The parameter can be in the native format or given as string representation
-of a number.
+The string representation may start with a '-' (minus). If a decimal '.' is used,
+it must be followed by at least one digit.
 
 Valid examples: