aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/url.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-05-09 17:12:08 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-05-09 17:12:08 -0700
commit73a7b52f0182a789bf45d4b0c23384911d1ed034 (patch)
tree3e28f90320728d00a2cbb2f8b4297fef902f2f67 /actionpack/lib/action_dispatch/http/url.rb
parent727ae97793906926fe0e87ec2f105fa47fd6d783 (diff)
downloadrails-73a7b52f0182a789bf45d4b0c23384911d1ed034.tar.gz
rails-73a7b52f0182a789bf45d4b0c23384911d1ed034.tar.bz2
rails-73a7b52f0182a789bf45d4b0c23384911d1ed034.zip
don't mutate the options hash, so we don't have to dup
avoids extra hash allocations on each call
Diffstat (limited to 'actionpack/lib/action_dispatch/http/url.rb')
-rw-r--r--actionpack/lib/action_dispatch/http/url.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb
index ce21d98174..f33a855bc2 100644
--- a/actionpack/lib/action_dispatch/http/url.rb
+++ b/actionpack/lib/action_dispatch/http/url.rb
@@ -29,10 +29,9 @@ module ActionDispatch
extract_subdomains(host, tld_length).join('.')
end
- def url_for(options = {})
- options = options.dup
- path = options.delete(:script_name).to_s.chomp("/")
- path << options.delete(:path).to_s
+ def url_for(options)
+ path = options[:script_name].to_s.chomp("/")
+ path << options[:path].to_s
params = options[:params].is_a?(Hash) ? options[:params] : options.slice(:params)
params.reject! { |_,v| v.to_param.nil? }