Permalink
Browse files

rm `same_host?`. The same conditional is two lines down.

  • Loading branch information...
tenderlove committed Jun 11, 2014
1 parent 15c2a5b commit 79469b4b0c05a50e19699bc9b568042add2d4987
Showing with 5 additions and 8 deletions.
  1. +5 −8 actionpack/lib/action_dispatch/http/url.rb
@@ -102,10 +102,6 @@ def named_host?(host)
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 @@ def normalize_protocol(protocol)
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))

0 comments on commit 79469b4

Please sign in to comment.