aboutsummaryrefslogtreecommitdiff
path: root/lib/puppet/type/cron.rb
diff options
context:
space:
mode:
authorLuchian Nemes <luchian.nemes@puppet.com>2020-10-29 16:08:54 +0200
committerLuchian Nemes <luchian.nemes@puppet.com>2020-10-29 16:35:44 +0200
commitae6c3499669c11aa3a7bd5b021ac64c033a2bed9 (patch)
treef6abd566ec0e1b0489c1d32fa1d2cd280da12e1b /lib/puppet/type/cron.rb
parent834768ee9d048f6bcf1e000af6797a22eeb2cb8c (diff)
downloadpuppet-cron_core-ae6c3499669c11aa3a7bd5b021ac64c033a2bed9.tar.gz
puppet-cron_core-ae6c3499669c11aa3a7bd5b021ac64c033a2bed9.tar.bz2
(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.
Diffstat (limited to 'lib/puppet/type/cron.rb')
-rw-r--r--lib/puppet/type/cron.rb8
1 files changed, 4 insertions, 4 deletions
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