diff --git a/lib/puppet/parser/functions/ceiling.rb b/lib/puppet/parser/functions/ceiling.rb deleted file mode 100644 index b8012356d..000000000 --- a/lib/puppet/parser/functions/ceiling.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -# -# ceiling.rb -# -module Puppet::Parser::Functions - newfunction(:ceiling, type: :rvalue, doc: <<-DOC - @summary - **Deprecated** Returns the smallest integer greater or equal to the argument. - Takes a single numeric value as an argument. - - > *Note:* - **Deprecated** from Puppet 6.0.0, this function has been replaced with a - built-in [`ceiling`](https://puppet.com/docs/puppet/latest/function.html#ceiling) function. - - @return [Integer] The rounded value - DOC - ) do |arguments| - raise(Puppet::ParseError, "ceiling(): 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, "ceiling(): Wrong argument type given (#{arguments[0]} for Numeric)") - end - - raise(Puppet::ParseError, "ceiling(): Wrong argument type given (#{arg.class} for Numeric)") if arg.is_a?(Numeric) == false - - arg.ceil - end -end - -# vim: set ts=2 sw=2 et : diff --git a/spec/functions/ceiling_spec.rb b/spec/functions/ceiling_spec.rb deleted file mode 100644 index 5e5f34c94..000000000 --- a/spec/functions/ceiling_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe 'ceiling', if: Puppet::Util::Package.versioncmp(Puppet.version, '6.0.0') < 0 do - it { is_expected.not_to eq(nil) } - it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{Wrong number of arguments}) } - it { is_expected.to run.with_params('foo').and_raise_error(Puppet::ParseError, %r{Wrong argument type given}) } - it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, %r{Wrong argument type given}) } - it { is_expected.to run.with_params(34).and_return(34) } - it { is_expected.to run.with_params(-34).and_return(-34) } - it { is_expected.to run.with_params(33.1).and_return(34) } - it { is_expected.to run.with_params(-33.1).and_return(-33) } - it { is_expected.to run.with_params('33.1').and_return(34) } -end