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/win32/registry.rb | |
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/win32/registry.rb')
-rw-r--r-- | lib/chef/win32/registry.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/win32/registry.rb b/lib/chef/win32/registry.rb index a5c63b571b..c31ae50e0b 100644 --- a/lib/chef/win32/registry.rb +++ b/lib/chef/win32/registry.rb @@ -20,7 +20,7 @@ require_relative "../reserved_names" require_relative "api" require_relative "../mixin/wide_string" -if RUBY_PLATFORM =~ /mswin|mingw32|windows/ +if RUBY_PLATFORM.match?(/mswin|mingw32|windows/) require_relative "../monkey_patches/win32/registry" require_relative "api/registry" require "win32/registry" unless defined?(Win32::Registry) @@ -31,7 +31,7 @@ class Chef class Win32 class Registry - if RUBY_PLATFORM =~ /mswin|mingw32|windows/ + if RUBY_PLATFORM.match?(/mswin|mingw32|windows/) include Chef::ReservedNames::Win32::API::Registry extend Chef::ReservedNames::Win32::API::Registry end |