Method: ActionDispatch::Http::URL#domain

Defined in:
actionpack/lib/action_dispatch/http/url.rb

#domain(tld_length = @@tld_length) ⇒ Object

Returns the domain part of a host, such as “rubyonrails.org” in “www.rubyonrails.org”. You can specify a different ‘tld_length`, such as 2 to catch rubyonrails.co.uk in “www.rubyonrails.co.uk”.



324
325
326
# File 'actionpack/lib/action_dispatch/http/url.rb', line 324

def domain(tld_length = @@tld_length)
  ActionDispatch::Http::URL.extract_domain(host, tld_length)
end