diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-06-11 15:02:42 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-06-11 15:32:53 -0700 |
commit | 5825eea4b139b9af089c3075d042d5d3160583ec (patch) | |
tree | fd79641ded1857ee4166b6e9ba774a35ab47b06b /lib/chef/mixin | |
parent | 3889eddfc9944b23caea412d05c08b9b156cb50f (diff) | |
download | chef-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/mixin')
-rw-r--r-- | lib/chef/mixin/securable.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/mixin/securable.rb b/lib/chef/mixin/securable.rb index c63e644604..08e92b27b7 100644 --- a/lib/chef/mixin/securable.rb +++ b/lib/chef/mixin/securable.rb @@ -172,14 +172,14 @@ class Chef end end - if RUBY_PLATFORM =~ /mswin|mingw|windows/ + if RUBY_PLATFORM.match?(/mswin|mingw|windows/) include WindowsSecurableAttributes end # Callback that fires when included; will extend the including class # with WindowsMacros and define #rights and #deny_rights on it. def self.included(including_class) - if RUBY_PLATFORM =~ /mswin|mingw|windows/ + if RUBY_PLATFORM.match?(/mswin|mingw|windows/) including_class.extend(WindowsMacros) # create a default 'rights' attribute including_class.rights_attribute(:rights) |