class Bundler::URI::Generic

def hostname=(v)


it is wrapped with brackets.
If the argument seems to be an IPv6 address,

uri.to_s #=> "http://[::1]/bar"
uri.hostname = "::1"
uri = Bundler::URI("http://foo/bar")

the argument can be a bare IPv6 address.
This method is the same as Bundler::URI::Generic#host= except

Sets the host part of the Bundler::URI as the argument with brackets for IPv6 addresses.
def hostname=(v)
  v = "[#{v}]" if /\A\[.*\]\z/ !~ v && /:/ =~ v
  self.host = v
end