Method: Addressable::URI#hostname

Defined in:
lib/addressable/uri.rb

#hostnameString

This method is same as URI::Generic#host except brackets for IPv6 (and ‘IPvFuture’) addresses are removed.

Returns:

  • (String)

    The hostname for this URI.

See Also:



1178
1179
1180
1181
# File 'lib/addressable/uri.rb', line 1178

def hostname
  v = self.host
  /\A\[(.*)\]\z/ =~ v ? $1 : v
end