Constants
USE_REGISTRY = false
COMPONENT = [ :scheme, :userinfo, :host, :port, :registry, :path, :opaque, :query, :fragment ].freeze
DEFAULT_PORT = nil
Attributes
[R] | fragment |
Returns the fragment component of the URI. URI("http://foo/bar/baz?search=FooBar#ponies").fragment #=> "ponies" |
[R] | opaque |
Returns the opaque part of the URI. URI("mailto:foo@example.org").opaque #=> "foo@example.org" URI("http://foo/bar/baz").opaque #=> nil The portion of the path that does not make use of the slash ‘/’. The path typically refers to an absolute path or an opaque part. (See RFC2396 Section 3 and 5.2.) |
[R] | query |
Returns the query component of the URI. URI("http://foo/bar/baz?search=FooBar").query #=> "search=FooBar" |
[R] | path |
Returns the path component of the URI. URI("http://foo/bar/baz").path #=> "/bar/baz" |
[R] | port |
Returns the port component of the URI. URI("http://foo/bar/baz").port #=> 80 URI("http://foo:8080/bar/baz").port #=> 8080 |
[R] | host |
Returns the host component of the URI. URI("http://foo/bar/baz").host #=> "foo" It returns nil if no host component exists. URI("mailto:foo@example.org").host #=> nil The component does not contain the port number. 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. URI("http://[::1]/bar/baz").host #=> "[::1]" URI("http://[::1]/bar/baz").hostname #=> "::1" |
[R] | scheme |
Returns the scheme component of the URI. URI("http://foo/bar/baz").scheme #=> "http" |