diff options
author | eileencodes <eileencodes@gmail.com> | 2015-05-01 09:47:34 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2015-05-02 09:31:03 -0400 |
commit | e260975baf5b1a54d03ecd685f62f697871b9b65 (patch) | |
tree | a350f977f44d29f4d0af8fb350e24d1cc91be1bd /actionpack/lib | |
parent | 1e7640e68db5af7d6ed7161bc08435ec7f80a8f3 (diff) | |
download | rails-e260975baf5b1a54d03ecd685f62f697871b9b65.tar.gz rails-e260975baf5b1a54d03ecd685f62f697871b9b65.tar.bz2 rails-e260975baf5b1a54d03ecd685f62f697871b9b65.zip |
Use `args` instead of `*args` in `kwargs_request?` method
`*args` is not required here and should be avoided when not necessary
because `*args` are slower than `args` and create unnecessary array
allocations.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/testing/integration.rb | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 33c24999f9..ca7ba90c40 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -604,7 +604,7 @@ module ActionController def process(action, *args) check_required_ivars - if kwarg_request?(*args) + if kwarg_request?(args) parameters, session, body, flash, http_method, format, xhr = args[0].values_at(:params, :session, :body, :flash, :method, :format, :xhr) else http_method, parameters, session, flash = args @@ -745,7 +745,7 @@ module ActionController private def process_with_kwargs(http_method, action, *args) - if kwarg_request?(*args) + if kwarg_request?(args) args.first.merge!(method: http_method) process(action, *args) else @@ -757,7 +757,7 @@ module ActionController end REQUEST_KWARGS = %i(params session flash method body xhr) - def kwarg_request?(*args) + def kwarg_request?(args) args[0].respond_to?(:keys) && ( (args[0].key?(:format) && args[0].keys.size == 1) || args[0].keys.any? { |k| REQUEST_KWARGS.include?(k) } diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index 3800c61dab..b1bd6ae6d5 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -81,7 +81,7 @@ module ActionDispatch # # xhr :get, '/feed', params: { since: 201501011400 } def xml_http_request(request_method, path, *args) - if kwarg_request?(*args) + if kwarg_request?(args) params, headers, env = args.first.values_at(:params, :headers, :env) else params = args[0] @@ -291,7 +291,7 @@ module ActionDispatch end def process_with_kwargs(http_method, path, *args) - if kwarg_request?(*args) + if kwarg_request?(args) process(http_method, path, *args) else non_kwarg_request_warning if args.present? @@ -300,7 +300,7 @@ module ActionDispatch end REQUEST_KWARGS = %i(params headers env xhr) - def kwarg_request?(*args) + def kwarg_request?(args) args[0].respond_to?(:keys) && args[0].keys.any? { |k| REQUEST_KWARGS.include?(k) } end |