diff options
author | Tim Smith <tsmith@chef.io> | 2018-03-11 13:42:34 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-03-14 09:51:49 -0700 |
commit | 3a7af28896be3702b933bd13dcfff96b98314ebd (patch) | |
tree | 23a9b9d00245fe21b81742feefdf31c8549d8b70 /lib/chef/http/http_request.rb | |
parent | 02775faa30db6a9ae98597cb6cd0e0c4defa7dc4 (diff) | |
download | chef-drop_23.tar.gz |
Use match? where we don't need the match datadrop_23
This is a Ruby 2.4-ism that's faster than =~ because it doesn't actually store the match. This is just autocorrected from Rubocop's Performance/RegexpMatch
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/http/http_request.rb')
-rw-r--r-- | lib/chef/http/http_request.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/http/http_request.rb b/lib/chef/http/http_request.rb index bd999d8f86..4d34837551 100644 --- a/lib/chef/http/http_request.rb +++ b/lib/chef/http/http_request.rb @@ -126,7 +126,7 @@ class Chef rescue NoMethodError => e # http://redmine.ruby-lang.org/issues/show/2708 # http://redmine.ruby-lang.org/issues/show/2758 - if e.to_s =~ /#{Regexp.escape(%q{undefined method `closed?' for nil:NilClass})}/ + if e.to_s.match?(/#{Regexp.escape(%q{undefined method `closed?' for nil:NilClass})}/) Chef::Log.debug("Rescued error in http connect, re-raising as Errno::ECONNREFUSED to hide bug in net/http") Chef::Log.debug("#{e.class.name}: #{e}") Chef::Log.debug(e.backtrace.join("\n")) |