From ae6c3499669c11aa3a7bd5b021ac64c033a2bed9 Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Thu, 29 Oct 2020 16:08:54 +0200 Subject: (MODULES-10852) Fix warnings introduced by Ruby 2.7 Ruby 2.7 introduced a warning for checking an Integer against a regular expression because this check always returns nil even though as a string it would respect the given regular expression. --- lib/puppet/type/cron.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/puppet/type/cron.rb') diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb index 186a5e7..a536410 100644 --- a/lib/puppet/type/cron.rb +++ b/lib/puppet/type/cron.rb @@ -73,7 +73,7 @@ Puppet::Type.newtype(:cron) do # in string form to actual integers, and returns the value if it's # an integer or false if it's just a normal string. def numfix(num) - if num =~ %r{^\d+$} || num.is_a?(Integer) + if num.is_a?(Integer) || num =~ %r{^\d+$} num else false @@ -155,17 +155,17 @@ Puppet::Type.newtype(:cron) do end # Allow step syntax - if value =~ %r{^\*/[0-9]+$} + if value.to_s =~ %r{^\*/[0-9]+$} return value end # Allow ranges - if value =~ %r{^[0-9]+-[0-9]+$} + if value.to_s =~ %r{^[0-9]+-[0-9]+$} return value end # Allow ranges with step - if value =~ %r{^[0-9]+-[0-9]+/[0-9]+$} + if value.to_s =~ %r{^[0-9]+-[0-9]+/[0-9]+$} return value end -- cgit v1.2.3