Method: Addressable::URI#tld=

Defined in:
lib/addressable/uri.rb

#tld=(new_tld) ⇒ Object

Sets the top-level domain for this URI.

Parameters:

  • new_tld (String, #to_str)

    The new top-level domain.



1215
1216
1217
1218
# File 'lib/addressable/uri.rb', line 1215

def tld=(new_tld)
  replaced_tld = host.sub(/#{tld}\z/, new_tld)
  self.host = PublicSuffix::Domain.new(replaced_tld).to_s
end