Checks the password v
component for RFC2396 compliance and against the URI::Parser
Regexp
for :USERINFO.
Can not have a registry or opaque component defined, with a user component defined.
Protected setter for the password component v
.
See also URI::Generic.password=
.
Returns the password component after URI
decoding.
Checks the host v
component for RFC2396 compliance and against the URI::Parser
Regexp
for :HOST.
Can not have a registry or opaque component defined, with a host component defined.
Checks the port v
component for RFC2396 compliance and against the URI::Parser
Regexp
for :PORT.
Can not have a registry or opaque component defined, with a port component defined.
Calculates relative path to oth from self.
require 'uri' uri = URI.parse('http://my.example.com') uri.route_to('http://my.example.com/main.rbx?page=1') #=> #<URI::Generic /main.rbx?page=1>
Checks the to v
component.
Private setter for to v
.
Returns the RFC822 e-mail text equivalent of the URL, as a String
.
Example:
require 'uri' uri = URI.parse("mailto:ruby-list@ruby-lang.org?Subject=subscribe&cc=myaddr") uri.to_mailtext # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n"
Returns Regexp
that is default self.regexp[:ABS_URI_REF]
, unless schemes
is provided. Then it is a Regexp.union
with self.pattern[:X_ABS_URI]
.
Constructs the default Hash
of Regexp’s.
Returns Regexp
that is default self.regexp[:ABS_URI_REF]
, unless schemes
is provided. Then it is a Regexp.union
with self.pattern[:X_ABS_URI]
.
Constructs the default Hash
of Regexp’s.
Converts the contents of the database to an in-memory Hash
object, and returns it.
Invoked by IO#read
or IO#Buffer.read to read length
bytes from io
into a specified buffer
(see IO::Buffer
) at the given offset
.
The length
argument is the “minimum length to be read”. If the IO
buffer size is 8KiB, but the length
is 1024
(1KiB), up to 8KiB might be read, but at least 1KiB will be. Generally, the only case where less data than length
will be read is if there is an error reading the data.
Specifying a length
of 0 is valid and means try reading at least once and return any available data.
Suggested implementation should try to read from io
in a non-blocking manner and call io_wait
if the io
is not ready (which will yield control to other fibers).
See IO::Buffer
for an interface available to return data.
Expected to return number of bytes read, or, in case of an error, -errno
(negated number corresponding to system’s error code).
The method should be considered experimental.
Invoked by IO#pread
or IO::Buffer#pread
to read length
bytes from io
at offset from
into a specified buffer
(see IO::Buffer
) at the given offset
.
This method is semantically the same as io_read
, but it allows to specify the offset to read from and is often better for asynchronous IO
on the same file.
The method should be considered experimental.
Returns the destination encoding as an encoding object.
Returns the one-character string which cause Encoding::UndefinedConversionError
.
ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP") begin ec.convert("\xa0") rescue Encoding::UndefinedConversionError puts $!.error_char.dump #=> "\xC2\xA0" p $!.error_char.encoding #=> #<Encoding:UTF-8> end
Returns the destination encoding as an encoding object.
Returns the discarded bytes when Encoding::InvalidByteSequenceError
occurs.
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1") begin ec.convert("abc\xA1\xFFdef") rescue Encoding::InvalidByteSequenceError p $! #=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "\xFF" on EUC-JP> puts $!.error_bytes.dump #=> "\xA1" puts $!.readagain_bytes.dump #=> "\xFF" end