summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/is_float.rb
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppetlabs.com>2014-05-08 14:43:06 -0700
committerHunter Haugen <hunter@puppetlabs.com>2014-05-08 14:55:23 -0700
commit0804121719e4bde856723e19e8ff8bf6f9c2d55d (patch)
treed4faff54b5acadcc430675e992897f32b7409a72 /lib/puppet/parser/functions/is_float.rb
parente2297a1ea6b711ca930a21adc56aefe7c602826f (diff)
downloadpuppet-stdlib-0804121719e4bde856723e19e8ff8bf6f9c2d55d.tar.gz
puppet-stdlib-0804121719e4bde856723e19e8ff8bf6f9c2d55d.tar.bz2
Fix the stdlib functions that fail tests
Diffstat (limited to 'lib/puppet/parser/functions/is_float.rb')
-rw-r--r--lib/puppet/parser/functions/is_float.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/is_float.rb b/lib/puppet/parser/functions/is_float.rb
index 911f3c2..a2da943 100644
--- a/lib/puppet/parser/functions/is_float.rb
+++ b/lib/puppet/parser/functions/is_float.rb
@@ -15,6 +15,9 @@ Returns true if the variable passed to this function is a float.
value = arguments[0]
+ # Only allow Numeric or String types
+ return false unless value.is_a?(Numeric) or value.is_a?(String)
+
if value != value.to_f.to_s and !value.is_a? Float then
return false
else