提交 160f56c2 编写于 作者: A Aaron Patterson

only extract domain from the options hash once

上级 21c62613
...@@ -124,18 +124,19 @@ def normalize_host(_host, options) ...@@ -124,18 +124,19 @@ def normalize_host(_host, options)
return _host unless named_host?(_host) return _host unless named_host?(_host)
tld_length = options[:tld_length] || @@tld_length tld_length = options[:tld_length] || @@tld_length
subdomain = options[:subdomain]
domain = options[:domain]
host = "" host = ""
subdomain = options[:subdomain]
if subdomain == true || !options.key?(:subdomain) if subdomain == true || !options.key?(:subdomain)
return _host if options[:domain].nil? return _host if domain.nil?
host << extract_subdomain(_host, tld_length) host << extract_subdomain(_host, tld_length)
elsif subdomain elsif subdomain
host << subdomain.to_param host << subdomain.to_param
end end
host << "." unless host.empty? host << "." unless host.empty?
host << (options[:domain] || extract_domain_from(_host, tld_length)) host << (domain || extract_domain_from(_host, tld_length))
host host
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册