提交 977a2f38 编写于 作者: A Aaron Patterson

lookup subdomain from the options hash once, defaulting to true

if the subdomain wasn't specified, it's the same as if specifying
:subdomain as `true`, so we can default the value to `true` safely.
上级 160f56c2
......@@ -124,11 +124,11 @@ def normalize_host(_host, options)
return _host unless named_host?(_host)
tld_length = options[:tld_length] || @@tld_length
subdomain = options[:subdomain]
subdomain = options.fetch :subdomain, true
domain = options[:domain]
host = ""
if subdomain == true || !options.key?(:subdomain)
if subdomain == true
return _host if domain.nil?
host << extract_subdomain(_host, tld_length)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册