class method
self.extract_domain
Ruby on Rails 7.0.10
Since v3.1.12Signature
self.extract_domain(host, tld_length)
Returns the domain part of a host given the domain level.
# Top-level domain example extract_domain('www.example.com', 1) # => "example.com" # Second-level domain example extract_domain('dev.www.example.co.uk', 2) # => "example.co.uk"
Parameters
-
hostreq -
tld_lengthreq
Source
# File actionpack/lib/action_dispatch/http/url.rb, line 22
def extract_domain(host, tld_length)
extract_domain_from(host, tld_length) if named_host?(host)
end
Defined in actionpack/lib/action_dispatch/http/url.rb line 22
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Http::URL