Method: Nitro::Request#domain
- Defined in:
- lib/nitro/cgi/request.rb
#domain(tld_length = 1) ⇒ Object
Returns the domain part of a host.
Examples
www.nitroproject.org: request.domain # => ‘nitroproject.org’ www.nitroproject.co.uk: request.domain(2) # => ‘nitroproject.co.uk’
68 69 70 |
# File 'lib/nitro/cgi/request.rb', line 68 def domain tld_length = 1 host.split('.').last(1 + tld_length).join('.') end |