diff options
author | Luchian Nemes <luchian.nemes@puppet.com> | 2020-10-29 16:08:54 +0200 |
---|---|---|
committer | Luchian Nemes <luchian.nemes@puppet.com> | 2020-10-29 16:35:44 +0200 |
commit | ae6c3499669c11aa3a7bd5b021ac64c033a2bed9 (patch) | |
tree | f6abd566ec0e1b0489c1d32fa1d2cd280da12e1b | |
parent | 834768ee9d048f6bcf1e000af6797a22eeb2cb8c (diff) | |
download | puppet-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.
-rw-r--r-- | lib/puppet/type/cron.rb | 8 |
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 |