summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/floor.rb
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2015-01-27 15:14:18 -0500
committerMicah Anderson <micah@riseup.net>2015-01-27 15:14:18 -0500
commit71123634744b9fe2ec7d6a3e38e9789fd84801e3 (patch)
tree1794e812d83facd93b3007c42632c63ddf1eb2fc /lib/puppet/parser/functions/floor.rb
parent71cb0f4c2c3bf95f62c9f189f5cef155b09a9682 (diff)
parent5863ab3901368310186790980aea2b0bf7cecb06 (diff)
Merge branch 'master' into leap
Diffstat (limited to 'lib/puppet/parser/functions/floor.rb')
-rw-r--r--lib/puppet/parser/functions/floor.rb7
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