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/action_controller | |
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/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 6 |
1 files changed, 3 insertions, 3 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) } |