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/provider/remote_file | |
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/provider/remote_file')
-rw-r--r-- | lib/chef/provider/remote_file/http.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/provider/remote_file/http.rb b/lib/chef/provider/remote_file/http.rb index 26332c061f..ef2461848d 100644 --- a/lib/chef/provider/remote_file/http.rb +++ b/lib/chef/provider/remote_file/http.rb @@ -130,7 +130,7 @@ class Chef # which tricks Chef::REST into decompressing the response body. In this # case you'd end up with a tar archive (no gzip) named, e.g., foo.tgz, # which is not what you wanted. - if uri.to_s =~ /gz$/ + if /gz$/.match?(uri.to_s) logger.trace("Turning gzip compression off due to filename ending in gz") opts[:disable_gzip] = true end |