Method: Bundler::URI::Generic#host
- Defined in:
- lib/bundler/vendor/uri/lib/uri/generic.rb
#host ⇒ Object
Returns the host component of the Bundler::URI.
Bundler::URI("http://foo/bar/baz").host #=> "foo"
It returns nil if no host component exists.
Bundler::URI("mailto:[email protected]").host #=> nil
The component does not contain the port number.
Bundler::URI("http://foo:8080/bar/baz").host #=> "foo"
Since IPv6 addresses are wrapped with brackets in URIs, this method returns IPv6 addresses wrapped with brackets. This form is not appropriate to pass to socket methods such as TCPSocket.open. If unwrapped host names are required, use the #hostname method.
Bundler::URI("http://[::1]/bar/baz").host #=> "[::1]"
Bundler::URI("http://[::1]/bar/baz").hostname #=> "::1"
243 244 245 |
# File 'lib/bundler/vendor/uri/lib/uri/generic.rb', line 243 def host @host end |