X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Ffloor.rb;h=df132fc389fd3b889024954347593a2f2050b3c0;hb=131e09855e065be940e104d9ab0f18940cc76257;hp=9a6f014d7c1f25ed98983581971e50f67514b8cc;hpb=ad88f67c13ae0f1a08936dad643f1e3509ab5f40;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/lib/puppet/parser/functions/floor.rb b/3rdparty/modules/stdlib/lib/puppet/parser/functions/floor.rb index 9a6f014d7..df132fc38 100644 --- a/3rdparty/modules/stdlib/lib/puppet/parser/functions/floor.rb +++ b/3rdparty/modules/stdlib/lib/puppet/parser/functions/floor.rb @@ -1,22 +1,25 @@ +# +# floor.rb +# module Puppet::Parser::Functions - newfunction(:floor, :type => :rvalue, :doc => <<-EOS + newfunction(:floor, :type => :rvalue, :doc => <<-DOC Returns the largest integer less or equal to the argument. Takes a single numeric value as an argument. - EOS - ) do |arguments| - raise(Puppet::ParseError, "floor(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 + Note: from Puppet 6.0.0, the compatible function with the same name in Puppet core + will be used instead of this function. + DOC + ) do |arguments| + + raise(Puppet::ParseError, "floor(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1 begin arg = Float(arguments[0]) - rescue TypeError, ArgumentError => e - raise(Puppet::ParseError, "floor(): Wrong argument type " + - "given (#{arguments[0]} for Numeric)") + 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 + raise(Puppet::ParseError, "floor(): Wrong argument type given (#{arg.class} for Numeric)") if arg.is_a?(Numeric) == false arg.floor end