aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-06-11 13:55:46 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-06-11 13:56:00 -0700
commit79469b4b0c05a50e19699bc9b568042add2d4987 (patch)
tree85ebad256abdd7d0fed36ed57c20e453a78955ad /actionpack
parent15c2a5be6e326614e0952630166a35f6f7404312 (diff)
downloadrails-79469b4b0c05a50e19699bc9b568042add2d4987.tar.gz
rails-79469b4b0c05a50e19699bc9b568042add2d4987.tar.bz2
rails-79469b4b0c05a50e19699bc9b568042add2d4987.zip
rm `same_host?`. The same conditional is two lines down.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/http/url.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb
index 6112ab2fd6..1ee9f3c89e 100644
--- a/actionpack/lib/action_dispatch/http/url.rb
+++ b/actionpack/lib/action_dispatch/http/url.rb
@@ -102,10 +102,6 @@ module ActionDispatch
host && IP_HOST_REGEXP !~ host
end
- def same_host?(options)
- (options[:subdomain] == true || !options.key?(:subdomain)) && options[:domain].nil?
- end
-
def normalize_protocol(protocol)
case protocol
when nil
@@ -120,15 +116,16 @@ module ActionDispatch
end
def normalize_host(_host, options)
- return _host if !named_host?(_host) || same_host?(options)
+ return _host unless named_host?(_host)
tld_length = options[:tld_length] || @@tld_length
- host = ""
+ host = nil
if options[:subdomain] == true || !options.key?(:subdomain)
- host << extract_subdomain(_host, tld_length).to_param
+ return _host if options[:domain].nil?
+ host = extract_subdomain(_host, tld_length).to_param
elsif options[:subdomain].present?
- host << options[:subdomain].to_param
+ host = options[:subdomain].to_param
end
host << "." unless host.empty?
host << (options[:domain] || extract_domain(_host, tld_length))