From 29797dad5481dd02ed89fa6a571759aedb9c0ada Mon Sep 17 00:00:00 2001 From: Thomas Nys Date: Sat, 18 Apr 2015 12:39:39 +0200 Subject: [PATCH] Mitigates Style/Proc --- examples/crack.rb | 2 +- examples/custom_parsers.rb | 2 +- features/steps/remote_service_steps.rb | 2 +- lib/httparty/request.rb | 2 +- spec/httparty_spec.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/crack.rb b/examples/crack.rb index 8b7f89d..66368e8 100644 --- a/examples/crack.rb +++ b/examples/crack.rb @@ -9,7 +9,7 @@ class Rep include HTTParty parser( - Proc.new do |body, format| + proc do |body, format| Crack::XML.parse(body) end ) diff --git a/examples/custom_parsers.rb b/examples/custom_parsers.rb index f6131a3..ec6c698 100644 --- a/examples/custom_parsers.rb +++ b/examples/custom_parsers.rb @@ -53,7 +53,7 @@ end class AdHocParsing include HTTParty parser( - Proc.new do |body, format| + proc do |body, format| case format when :json body.to_json diff --git a/features/steps/remote_service_steps.rb b/features/steps/remote_service_steps.rb index b72bb21..02ba5b1 100644 --- a/features/steps/remote_service_steps.rb +++ b/features/steps/remote_service_steps.rb @@ -19,7 +19,7 @@ end Given /^that service takes (\d+) seconds to generate a response$/ do |time| @server_response_time = time.to_i - @handler.preprocessor = Proc.new { sleep time.to_i } + @handler.preprocessor = proc { sleep time.to_i } end Given /^a remote deflate service$/ do diff --git a/lib/httparty/request.rb b/lib/httparty/request.rb index d6d3143..16b06b2 100644 --- a/lib/httparty/request.rb +++ b/lib/httparty/request.rb @@ -14,7 +14,7 @@ module HTTParty SupportedURISchemes = [URI::HTTP, URI::HTTPS, URI::Generic] - NON_RAILS_QUERY_STRING_NORMALIZER = Proc.new do |query| + NON_RAILS_QUERY_STRING_NORMALIZER = proc do |query| Array(query).sort_by { |a| a[0].to_s }.map do |key, value| if value.nil? key.to_s diff --git a/spec/httparty_spec.rb b/spec/httparty_spec.rb index 2e0d623..f2c065a 100644 --- a/spec/httparty_spec.rb +++ b/spec/httparty_spec.rb @@ -318,7 +318,7 @@ RSpec.describe HTTParty do end let(:parser) do - Proc.new { |data, format| CustomParser.parse(data) } + proc { |data, format| CustomParser.parse(data) } end it "should set parser options" do