summaryrefslogtreecommitdiff
path: root/lib/chef/provider/service/redhat.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-06-11 15:02:42 -0700
committerTim Smith <tsmith84@gmail.com>2020-06-11 15:32:53 -0700
commit5825eea4b139b9af089c3075d042d5d3160583ec (patch)
treefd79641ded1857ee4166b6e9ba774a35ab47b06b /lib/chef/provider/service/redhat.rb
parent3889eddfc9944b23caea412d05c08b9b156cb50f (diff)
downloadchef-5825eea4b139b9af089c3075d042d5d3160583ec.tar.gz
Use .match? not =~ when match values aren't necessary
Autocorrected from RuboCop Performance which is now smart enough to detect when you use the match and when you don't. Using match? does not create any objects so it's slightly faster and uses less memory. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/provider/service/redhat.rb')
-rw-r--r--lib/chef/provider/service/redhat.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb
index 6851e7f150..ec78ef2240 100644
--- a/lib/chef/provider/service/redhat.rb
+++ b/lib/chef/provider/service/redhat.rb
@@ -87,7 +87,7 @@ class Chef
chkconfig.stdout.split(/\s+/)[1..-1].each do |level|
index = level.split(":").first
status = level.split(":").last
- if level =~ CHKCONFIG_ON
+ if CHKCONFIG_ON.match?(level)
@current_run_levels << index.to_i
all_levels_match = false unless run_levels.include?(index.to_i)
else