Method: Bundler::URI::Generic#hostname=
- Defined in:
- lib/bundler/vendor/uri/lib/uri/generic.rb
#hostname=(v) ⇒ Object
Sets the host part of the Bundler::URI as the argument with brackets for IPv6 addresses.
This method is the same as Bundler::URI::Generic#host= except the argument can be a bare IPv6 address.
uri = Bundler::URI("http://foo/bar")
uri.hostname = "::1"
uri.to_s #=> "http://[::1]/bar"
If the argument seems to be an IPv6 address, it is wrapped with brackets.
671 672 673 674 |
# File 'lib/bundler/vendor/uri/lib/uri/generic.rb', line 671 def hostname=(v) v = "[#{v}]" if !(v&.start_with?('[') && v&.end_with?(']')) && v&.index(':') self.host = v end |