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_dispatch | |
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_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/integration.rb | 6 |
1 files changed, 3 insertions, 3 deletions
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 |