From a37018532dbede7bc67ba8748a8275f6a167961f Mon Sep 17 00:00:00 2001 From: Thomas Nys Date: Sat, 18 Apr 2015 13:44:56 +0200 Subject: [PATCH] Mitigates Style/IncosistentIndentation --- lib/httparty.rb | 38 +++++++++++++++---------------- spec/httparty/cookie_hash_spec.rb | 6 ++--- spec/support/ssl_test_server.rb | 34 +++++++++++++-------------- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/lib/httparty.rb b/lib/httparty.rb index 35b3f93..c62c967 100644 --- a/lib/httparty.rb +++ b/lib/httparty.rb @@ -514,30 +514,30 @@ module HTTParty private - def perform_request(http_method, path, options, &block) #:nodoc: - options = ModuleInheritableAttributes.hash_deep_dup(default_options).merge(options) - process_headers(options) - process_cookies(options) - Request.new(http_method, path, options).perform(&block) - end + def perform_request(http_method, path, options, &block) #:nodoc: + options = ModuleInheritableAttributes.hash_deep_dup(default_options).merge(options) + process_headers(options) + process_cookies(options) + Request.new(http_method, path, options).perform(&block) + end - def process_headers(options) - if options[:headers] && headers.any? - options[:headers] = headers.merge(options[:headers]) - end + def process_headers(options) + if options[:headers] && headers.any? + options[:headers] = headers.merge(options[:headers]) end + end - def process_cookies(options) #:nodoc: - return unless options[:cookies] || default_cookies.any? - options[:headers] ||= headers.dup - options[:headers]["cookie"] = cookies.merge(options.delete(:cookies) || {}).to_cookie_string - end + def process_cookies(options) #:nodoc: + return unless options[:cookies] || default_cookies.any? + options[:headers] ||= headers.dup + options[:headers]["cookie"] = cookies.merge(options.delete(:cookies) || {}).to_cookie_string + end - def validate_format - if format && parser.respond_to?(:supports_format?) && !parser.supports_format?(format) - raise UnsupportedFormat, "'#{format.inspect}' Must be one of: #{parser.supported_formats.map(&:to_s).sort.join(', ')}" - end + def validate_format + if format && parser.respond_to?(:supports_format?) && !parser.supports_format?(format) + raise UnsupportedFormat, "'#{format.inspect}' Must be one of: #{parser.supported_formats.map(&:to_s).sort.join(', ')}" end + end end def self.normalize_base_uri(url) #:nodoc: diff --git a/spec/httparty/cookie_hash_spec.rb b/spec/httparty/cookie_hash_spec.rb index 9f48719..a4cba74 100644 --- a/spec/httparty/cookie_hash_spec.rb +++ b/spec/httparty/cookie_hash_spec.rb @@ -38,9 +38,9 @@ RSpec.describe HTTParty::CookieHash do it "should handle '=' within cookie value" do @cookie_hash.add_cookies("first=one=1; second=two=2==") - expect(@cookie_hash.keys).to include(:first, :second) - expect(@cookie_hash[:first]).to eq('one=1') - expect(@cookie_hash[:second]).to eq('two=2==') + expect(@cookie_hash.keys).to include(:first, :second) + expect(@cookie_hash[:first]).to eq('one=1') + expect(@cookie_hash[:second]).to eq('two=2==') end end diff --git a/spec/support/ssl_test_server.rb b/spec/support/ssl_test_server.rb index f48fc58..8a84982 100644 --- a/spec/support/ssl_test_server.rb +++ b/spec/support/ssl_test_server.rb @@ -47,22 +47,22 @@ class SSLTestServer private - def thread_main - until @stopping_mutex.synchronize { @stopping } - (rr, _, _) = select([@ssl_server.to_io], nil, nil, 0.1) + def thread_main + until @stopping_mutex.synchronize { @stopping } + (rr, _, _) = select([@ssl_server.to_io], nil, nil, 0.1) - next unless rr && rr.include?(@ssl_server.to_io) + next unless rr && rr.include?(@ssl_server.to_io) - socket = @ssl_server.accept + socket = @ssl_server.accept - Thread.new { - header = [] + Thread.new { + header = [] - until (line = socket.readline).rstrip.empty? - header << line - end + until (line = socket.readline).rstrip.empty? + header << line + end - response = <