class URI::Generic
def hostname
p u.host #=> "[::1]"
p u.hostname #=> "::1"
u = URI("http://[::1]/bar")
brackets for IPv6 (and future IP) addresses are removed.
This method is same as URI::Generic#host except
extract the host part of the URI and unwrap brackets for IPv6 addresses.
def hostname v = self.host /\A\[(.*)\]\z/ =~ v ? $1 : v end