v2_1_10 - Show latest stable - 0 notes - Class: URI::Generic
hostname=(v) public

set the host part of the URI as the argument with brackets for IPv6 addresses.

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

u = URI(“http://foo/bar”) p u.to_s #=> “http://foo/bar” u.hostname = “::1” p u.to_s #=> “http://[::1]/bar”

If the argument seems IPv6 address, it is wrapped by brackets.

Show source
Register or log in to add new notes.