Results for: "uri"

No documentation available

Returns normalized URI.

require 'uri'

URI("HTTP://my.EXAMPLE.com").normalize
#=> #<URI::HTTP http://my.example.com/>

Normalization here means:

Destructive version of normalize.

Compares two URIs.

Returns the hash value.

Compares with oth for Hash.

Args

components

Multiple Symbol arguments defined in URI::HTTP.

Description

Selects specified components from URI.

Usage

require 'uri'

uri = URI.parse('http://myuser:mypass@my.example.com/test.rbx')
uri.select(:userinfo, :host, :path)
# => ["myuser:mypass", "my.example.com", "/test.rbx"]

Args

v

URI or String

Description

Attempts to parse other URI oth, returns [parsed_oth, self].

Usage

require 'uri'

uri = URI.parse("http://my.example.com")
uri.coerce("http://foo.com")
#=> [#<URI::HTTP http://foo.com>, #<URI::HTTP http://my.example.com>]

Description

Creates a new URI::LDAP object from components, with syntax checking.

The components accepted are host, port, dn, attributes, scope, filter, and extensions.

The components should be provided either as an Array, or as a Hash with keys formed by preceding the component names with a colon.

If an Array is used, the components must be passed in the order [host, port, dn, attributes, scope, filter, extensions].

Example:

uri = URI::LDAP.build({:host => 'ldap.example.com',
  :dn => '/dc=example'})

uri = URI::LDAP.build(["ldap.example.com", nil,
  "/dc=example;dc=com", "query", nil, nil, nil])

Description

Creates a new URI::LDAP object from generic URI components as per RFC 2396. No LDAP-specific syntax checking is performed.

Arguments are scheme, userinfo, host, port, registry, path, opaque, query, and fragment, in that order.

Example:

uri = URI::LDAP.new("ldap", nil, "ldap.example.com", nil, nil,
  "/dc=example;dc=com", nil, "query", nil)

See also URI::Generic.new.

Returns dn.

Setter for dn val.

Returns scope.

Setter for scope val.

Returns filter.

Setter for filter val.

Returns extensions.

Setter for extensions val.

Checks if URI has a path. For URI::LDAP this will return false.

Description

Creates a new URI::MailTo object from components, with syntax checking.

Components can be provided as an Array or Hash. If an Array is used, the components must be supplied as [to, headers].

If a Hash is used, the keys are the component names preceded by colons.

The headers can be supplied as a pre-encoded string, such as "subject=subscribe&cc=address", or as an Array of Arrays like [['subject', 'subscribe'], ['cc', 'address']].

Examples:

require 'uri'

m1 = URI::MailTo.build(['joe@example.com', 'subject=Ruby'])
m1.to_s  # => "mailto:joe@example.com?subject=Ruby"

m2 = URI::MailTo.build(['john@example.com', [['Subject', 'Ruby'], ['Cc', 'jack@example.com']]])
m2.to_s  # => "mailto:john@example.com?Subject=Ruby&Cc=jack@example.com"

m3 = URI::MailTo.build({:to => 'listman@example.com', :headers => [['subject', 'subscribe']]})
m3.to_s  # => "mailto:listman@example.com?subject=subscribe"

Description

Creates a new URI::MailTo object from generic URL components with no syntax checking.

This method is usually called from URI::parse, which checks the validity of each component.

Setter for to v.

Setter for headers v.

Description

Creates a new URI::WS object from components, with syntax checking.

The components accepted are userinfo, host, port, path, and query.

The components should be provided either as an Array, or as a Hash with keys formed by preceding the component names with a colon.

If an Array is used, the components must be passed in the order [userinfo, host, port, path, query].

Example:

uri = URI::WS.build(host: 'www.example.com', path: '/foo/bar')

uri = URI::WS.build([nil, "www.example.com", nil, "/path", "query"])

Currently, if passed userinfo components this method generates invalid WS URIs as per RFC 1738.

Returns a URL-encoded string derived from the given Enumerable enum.

The result is suitable for use as form data for an HTTP request whose Content-Type is 'application/x-www-form-urlencoded'.

The returned string consists of the elements of enum, each converted to one or more URL-encoded strings, and all joined with character '&'.

Simple examples:

URI.encode_www_form([['foo', 0], ['bar', 1], ['baz', 2]])
# => "foo=0&bar=1&baz=2"
URI.encode_www_form({foo: 0, bar: 1, baz: 2})
# => "foo=0&bar=1&baz=2"

The returned string is formed using method URI.encode_www_form_component, which converts certain characters:

URI.encode_www_form('f#o': '/', 'b-r': '$', 'b z': '@')
# => "f%23o=%2F&b-r=%24&b+z=%40"

When enum is Array-like, each element ele is converted to a field:

The elements of an Array-like enum may be mixture:

URI.encode_www_form([['foo', 0], ['bar', 1, 2], ['baz'], :bat])
# => "foo=0&bar=1&baz&bat"

When enum is Hash-like, each key/value pair is converted to one or more fields:

The elements of a Hash-like enum may be mixture:

URI.encode_www_form({foo: [0, 1], bar: 2})
# => "foo=0&foo=1&bar=2"
Search took: 1ms  ·  Total Results: 1002