method
extract_subdomain
v7.1.3.4 -
Show latest stable
- Class:
ActionDispatch::Http::URL
extract_subdomain(host, tld_length)public
Returns the subdomains of a host as a String given the domain level.
# Top-level domain example extract_subdomain('www.example.com', 1) # => "www" # Second-level domain example extract_subdomain('dev.www.example.co.uk', 2) # => "dev.www"