diff options
author | Ashley Penney <ashley.penney@puppetlabs.com> | 2014-05-08 18:16:05 -0400 |
---|---|---|
committer | Ashley Penney <ashley.penney@puppetlabs.com> | 2014-05-08 18:16:05 -0400 |
commit | 14d656dd415e75bc8768606944d579f182ede9ec (patch) | |
tree | d4faff54b5acadcc430675e992897f32b7409a72 /lib/puppet/parser/functions/floor.rb | |
parent | e2297a1ea6b711ca930a21adc56aefe7c602826f (diff) | |
parent | 0804121719e4bde856723e19e8ff8bf6f9c2d55d (diff) | |
download | puppet-stdlib-14d656dd415e75bc8768606944d579f182ede9ec.tar.gz puppet-stdlib-14d656dd415e75bc8768606944d579f182ede9ec.tar.bz2 |
Merge pull request #251 from hunner/fix_tests
Fix the stdlib functions that fail tests
Diffstat (limited to 'lib/puppet/parser/functions/floor.rb')
-rw-r--r-- | lib/puppet/parser/functions/floor.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/floor.rb b/lib/puppet/parser/functions/floor.rb index a401923..9a6f014 100644 --- a/lib/puppet/parser/functions/floor.rb +++ b/lib/puppet/parser/functions/floor.rb @@ -8,7 +8,12 @@ module Puppet::Parser::Functions raise(Puppet::ParseError, "floor(): Wrong number of arguments " + "given (#{arguments.size} for 1)") if arguments.size != 1 - arg = arguments[0] + begin + arg = Float(arguments[0]) + rescue TypeError, ArgumentError => e + raise(Puppet::ParseError, "floor(): Wrong argument type " + + "given (#{arguments[0]} for Numeric)") + end raise(Puppet::ParseError, "floor(): Wrong argument type " + "given (#{arg.class} for Numeric)") if arg.is_a?(Numeric) == false |