Results for: "uri"

No documentation available

Description

Returns the full path for an HTTP request, as required by Net::HTTP::Get.

If the URI contains a query, the full path is URI#path + ‘?’ + URI#query. Otherwise, the path is simply URI#path.

Example:

uri = URI::HTTP.build(path: '/foo/bar', query: 'test=true')
uri.request_uri #  => "/foo/bar?test=true"

Description

Returns the full path for a WS URI, as required by Net::HTTP::Get.

If the URI contains a query, the full path is URI#path + ‘?’ + URI#query. Otherwise, the path is simply URI#path.

Example:

uri = URI::WS.build(path: '/foo/bar', query: 'test=true')
uri.request_uri #  => "/foo/bar?test=true"

Returns uri converted to an URI object.

Returns uri converted to an URI object.

Get the URI defining the local dRuby space.

This is the URI of the current server. See current_server.

Get the URI defining the local dRuby space.

This is the URI of the current server. See current_server.

No documentation available
No documentation available

Description

Returns the authority for an HTTP uri, as defined in datatracker.ietf.org/doc/html/rfc3986/#section-3.2.

Example:

URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').authority #=> "www.example.com"
URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').authority #=> "www.example.com:8000"
URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').authority #=> "www.example.com"

Description

Returns the origin for an HTTP uri, as defined in datatracker.ietf.org/doc/html/rfc6454.

Example:

URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').origin #=> "http://www.example.com"
URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').origin #=> "http://www.example.com:8000"
URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').origin #=> "http://www.example.com"
URI::HTTPS.build(host: 'www.example.com', path: '/foo/bar').origin #=> "https://www.example.com"

Sets userinfo, argument is string like ‘name:pass’.

Returns the userinfo, either as ‘user’ or ‘user:password’.

Returns attributes.

Setter for attributes val.

Allows the opening of various resources including URIs.

If the first argument responds to the ‘open’ method, ‘open’ is called on it with the rest of the arguments.

If the first argument is a string that begins with (protocol)://, it is parsed by URI.parse. If the parsed object responds to the ‘open’ method, ‘open’ is called on it with the rest of the arguments.

Otherwise, Kernel#open is called.

OpenURI::OpenRead#open provides URI::HTTP#open, URI::HTTPS#open and URI::FTP#open, Kernel#open.

We can accept URIs and strings that begin with http://, https:// and ftp://. In these cases, the opened file object is extended by OpenURI::Meta.

Construct a URI instance, using the scheme to detect the appropriate class from URI.scheme_list.

Synopsis

URI::split(uri)

Args

uri

String with URI.

Description

Splits the string on following parts and returns array with result:

Usage

require 'uri'

URI.split("http://www.ruby-lang.org/")
# => ["http", nil, "www.ruby-lang.org", nil, nil, "/", nil, nil, nil]

Synopsis

URI::parse(uri_str)

Args

uri_str

String with URI.

Description

Creates one of the URI’s subclasses instance from the string.

Raises

URI::InvalidURIError

Raised if URI given is not a correct one.

Usage

require 'uri'

uri = URI.parse("http://www.ruby-lang.org/")
# => #<URI::HTTP http://www.ruby-lang.org/>
uri.scheme
# => "http"
uri.host
# => "www.ruby-lang.org"

It’s recommended to first ::escape the provided uri_str if there are any invalid URI characters.

Synopsis

URI::join(str[, str, ...])

Args

str

String(s) to work with, will be converted to RFC3986 URIs before merging.

Description

Joins URIs.

Usage

require 'uri'

URI.join("http://example.com/","main.rbx")
# => #<URI::HTTP http://example.com/main.rbx>

URI.join('http://example.com', 'foo')
# => #<URI::HTTP http://example.com/foo>

URI.join('http://example.com', '/foo', '/bar')
# => #<URI::HTTP http://example.com/bar>

URI.join('http://example.com', '/foo', 'bar')
# => #<URI::HTTP http://example.com/bar>

URI.join('http://example.com', '/foo/', 'bar')
# => #<URI::HTTP http://example.com/foo/bar>

Synopsis

URI::extract(str[, schemes][,&blk])

Args

str

String to extract URIs from.

schemes

Limit URI matching to specific schemes.

Description

Extracts URIs from a string. If block given, iterates through all matched URIs. Returns nil if block given or array with matches.

Usage

require "uri"

URI.extract("text here http://foo.example.org/bla and here mailto:test@example.com and here also.")
# => ["http://foo.example.com/bla", "mailto:test@example.com"]

Synopsis

URI::regexp([match_schemes])

Args

match_schemes

Array of schemes. If given, resulting regexp matches to URIs whose scheme is one of the match_schemes.

Description

Returns a Regexp object which matches to URI-like strings. The Regexp object returned by this method includes arbitrary number of capture group (parentheses). Never rely on its number.

Usage

require 'uri'

# extract first URI from html_string
html_string.slice(URI.regexp)

# remove ftp URIs
html_string.sub(URI.regexp(['ftp']), '')

# You should not rely on the number of parentheses
html_string.scan(URI.regexp) do |*matches|
  p $&
end
No documentation available
No documentation available

Parse uri into a [uri, option] pair.

The DRbProtocol module asks each registered protocol in turn to try to parse the URI. Each protocol signals that it does not handle that URI by raising a DRbBadScheme error. If no protocol recognises the URI, then a DRbBadURI error is raised.

Search took: 3ms  ·  Total Results: 879