From 271d3e4f91e3d158c9112512ac75d0ca51fc928d Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Tue, 23 Feb 2016 10:45:15 -0800 Subject: Autofixing new Perf cops in 0.37.2 6 Performance/Casecmp 18 Performance/Detect 1 Performance/RangeInclude 27 Performance/RedundantBlockCall 6 Performance/RedundantMatch 5 Performance/RedundantMerge 18 Performance/StringReplacement --- lib/chef/http/authenticator.rb | 2 +- lib/chef/http/basic_client.rb | 2 +- lib/chef/http/remote_request_id.rb | 2 +- lib/chef/http/socketless_chef_zero_client.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/chef/http') diff --git a/lib/chef/http/authenticator.rb b/lib/chef/http/authenticator.rb index b5e28cf54d..84065bf816 100644 --- a/lib/chef/http/authenticator.rb +++ b/lib/chef/http/authenticator.rb @@ -47,7 +47,7 @@ class Chef end def handle_request(method, url, headers = {}, data = false) - headers.merge!({ "X-Ops-Server-API-Version" => @api_version }) + headers["X-Ops-Server-API-Version"] = @api_version headers.merge!(authentication_headers(method, url, data, headers)) if sign_requests? [method, url, headers, data] end diff --git a/lib/chef/http/basic_client.rb b/lib/chef/http/basic_client.rb index e0a02a05cf..58ae496418 100644 --- a/lib/chef/http/basic_client.rb +++ b/lib/chef/http/basic_client.rb @@ -104,7 +104,7 @@ class Chef # proxy before parsing. The regex /^.*:\/\// matches, for example, http://. Reusing proxy # here since we are really just trying to get the string built correctly. if String === proxy && !proxy.strip.empty? - if proxy.match(/^.*:\/\//) + if proxy =~ /^.*:\/\// proxy = URI.parse(proxy.strip) else proxy = URI.parse("#{url.scheme}://#{proxy.strip}") diff --git a/lib/chef/http/remote_request_id.rb b/lib/chef/http/remote_request_id.rb index ef8a18a1e3..a779df805e 100644 --- a/lib/chef/http/remote_request_id.rb +++ b/lib/chef/http/remote_request_id.rb @@ -25,7 +25,7 @@ class Chef end def handle_request(method, url, headers = {}, data = false) - headers.merge!({ "X-REMOTE-REQUEST-ID" => Chef::RequestID.instance.request_id }) + headers["X-REMOTE-REQUEST-ID"] = Chef::RequestID.instance.request_id [method, url, headers, data] end diff --git a/lib/chef/http/socketless_chef_zero_client.rb b/lib/chef/http/socketless_chef_zero_client.rb index c8590903f6..e25242c033 100644 --- a/lib/chef/http/socketless_chef_zero_client.rb +++ b/lib/chef/http/socketless_chef_zero_client.rb @@ -67,7 +67,7 @@ class Chef end if block_given? - block.call(@body) + yield(@body) else super end -- cgit v1.2.1