oth
URI
or String
Destructive form of merge
require 'uri' uri = URI.parse("http://my.example.com") uri.merge!("/main.rbx?page=1") p uri # => #<URI::HTTP:0x2021f3b0 URL:http://my.example.com/main.rbx?page=1>
oth
URI
or String
Merges two URI’s.
require 'uri' uri = URI.parse("http://my.example.com") p uri.merge("/main.rbx?page=1") # => #<URI::HTTP:0x2021f3b0 URL:http://my.example.com/main.rbx?page=1>
return base and rel. you can modify ‘base’, but can not ‘rel’.
Returns normalized URI
Destructive version of normalize
Compares to URI’s
Selects specified components from URI
require 'uri' uri = URI.parse('http://myuser:mypass@my.example.com/test.rbx') p uri.select(:userinfo, :host, :path) # => ["myuser:mypass", "my.example.com", "/test.rbx"]
v
URI
or String
attempt to parse other URI +oth+ return [parsed_oth, self]
require 'uri' uri = URI.parse("http://my.example.com") uri.coerce("http://foo.com") #=> [#<URI::HTTP:0x00000000bcb028 URL:http://foo.com/>, #<URI::HTTP:0x00000000d92178 URL:http://my.example.com>]
Create 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:
newuri = URI::LDAP.build({:host => 'ldap.example.com', :dn> => '/dc=example'}) newuri = URI::LDAP.build(["ldap.example.com", nil, "/dc=example;dc=com", "query", nil, nil, nil])
Create 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, "/dc=example;dc=com", "query", nil, nil, nil, 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
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
Examples:
require 'uri' m1 = URI::MailTo.build(['joe@example.com', 'subject=Ruby']) puts m1.to_s -> mailto:joe@example.com?subject=Ruby m2 = URI::MailTo.build(['john@example.com', [['Subject', 'Ruby'], ['Cc', 'jack@example.com']]]) puts m2.to_s -> mailto:john@example.com?Subject=Ruby&Cc=jack@example.com m3 = URI::MailTo.build({:to => 'listman@example.com', :headers => [['subject', 'subscribe']]}) puts m3.to_s -> mailto:listman@example.com?subject=subscribe