diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2014-07-31 13:09:32 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2014-07-31 13:24:17 -0300 |
commit | fafff357cc775dab2cc46feaf43d311a7a042283 (patch) | |
tree | e01b85257039127fbad1d8062eee381aed0019ad /actionpack/lib/action_dispatch/http | |
parent | 277247110cb77e69ea113a3aa77a9c12322ffcfb (diff) | |
download | rails-fafff357cc775dab2cc46feaf43d311a7a042283.tar.gz rails-fafff357cc775dab2cc46feaf43d311a7a042283.tar.bz2 rails-fafff357cc775dab2cc46feaf43d311a7a042283.zip |
Rename variable to better show its intent
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r-- | actionpack/lib/action_dispatch/http/url.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index 12d3b10981..ef07a101ad 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -49,27 +49,27 @@ module ActionDispatch end def path_for(options) - result = options[:script_name].to_s.chomp("/") - result << options[:path].to_s - result = add_trailing_slash(result) if options[:trailing_slash] - result = add_params(result, options[:params]) if options.key?(:params) - result = add_anchor(result, options[:anchor]) if options.key?(:anchor) - result + path = options[:script_name].to_s.chomp("/") + path << options[:path].to_s + path = add_trailing_slash(path) if options[:trailing_slash] + path = add_params(path, options[:params]) if options.key?(:params) + path = add_anchor(path, options[:anchor]) if options.key?(:anchor) + path end private - def add_params(result, params) + def add_params(path, params) params = { params: params } unless params.is_a?(Hash) params.reject! { |_,v| v.to_param.nil? } - result << "?#{params.to_query}" unless params.empty? + path << "?#{params.to_query}" unless params.empty? - result + path end - def add_anchor(result, anchor) - result << "##{Journey::Router::Utils.escape_fragment(anchor.to_param.to_s)}" - result + def add_anchor(path, anchor) + path << "##{Journey::Router::Utils.escape_fragment(anchor.to_param.to_s)}" + path end def extract_domain_from(host, tld_length) |