method
extract_subdomains
v5.1.7 -
Show latest stable
- Class:
ActionDispatch::Http::URL
extract_subdomains(host, tld_length)public
Returns the subdomains of a host as an Array given the domain level.
# Top-level domain example extract_subdomains('www.example.com', 1) # => ["www"] # Second-level domain example extract_subdomains('dev.www.example.co.uk', 2) # => ["dev", "www"]