do nothing
Returns default port.
Returns default port.
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 userinfo ui
as [user, password]
if properly formatted as ‘user:password’.
Escapes ‘user:password’ v
based on RFC 1738 section 3.1.
Returns the password component after URI
decoding.
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.
Checks the path v
component for RFC2396 compliance and against the URI::Parser Regexp
for :ABS_PATH and :REL_PATH.
Can not have a opaque component defined, with a path component defined.
Checks the opaque v
component for RFC2396 compliance and against the URI::Parser Regexp
for :OPAQUE.
Can not have a host, port, user, or path component defined, with an opaque component defined.
Merges a base path base
, with relative path rel
, returns a modified base path.
Calls the given block once for each key
, value
pair in the database.
Returns self
.
Invoked by Process::Status.wait
in order to wait for a specified process. See that method description for arguments description.
Suggested minimal implementation:
Thread.new do Process::Status.wait(pid, flags) end.value
This hook is optional: if it is not present in the current scheduler, Process::Status.wait
will behave as a blocking method.
Expected to return a Process::Status
instance.
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.
Invoked by IO.select
to ask whether the specified descriptors are ready for specified events within the specified timeout
.
Expected to return the 3-tuple of Array
of IOs that are ready.
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 corresponding ASCII compatible encoding.
Returns nil if the argument is an ASCII compatible encoding.
“corresponding ASCII compatible encoding” is an ASCII compatible encoding which can represents exactly the same characters as the given ASCII incompatible encoding. So, no conversion undefined error occurs when converting between the two encodings.
Encoding::Converter.asciicompat_encoding("ISO-2022-JP") #=> #<Encoding:stateless-ISO-2022-JP> Encoding::Converter.asciicompat_encoding("UTF-16BE") #=> #<Encoding:UTF-8> Encoding::Converter.asciicompat_encoding("UTF-8") #=> nil
Inserts string into the encoding converter. The string will be converted to the destination encoding and output on later conversions.
If the destination encoding is stateful, string is converted according to the state and the state is updated.
This method should be used only when a conversion error occurs.
ec = Encoding::Converter.new("utf-8", "iso-8859-1") src = "HIRAGANA LETTER A is \u{3042}." dst = "" p ec.primitive_convert(src, dst) #=> :undefined_conversion puts "[#{dst.dump}, #{src.dump}]" #=> ["HIRAGANA LETTER A is ", "."] ec.insert_output("<err>") p ec.primitive_convert(src, dst) #=> :finished puts "[#{dst.dump}, #{src.dump}]" #=> ["HIRAGANA LETTER A is <err>.", ""] ec = Encoding::Converter.new("utf-8", "iso-2022-jp") src = "\u{306F 3041 3068 2661 3002}" # U+2661 is not representable in iso-2022-jp dst = "" p ec.primitive_convert(src, dst) #=> :undefined_conversion puts "[#{dst.dump}, #{src.dump}]" #=> ["\e$B$O$!$H".force_encoding("ISO-2022-JP"), "\xE3\x80\x82"] ec.insert_output "?" # state change required to output "?". p ec.primitive_convert(src, dst) #=> :finished puts "[#{dst.dump}, #{src.dump}]" #=> ["\e$B$O$!$H\e(B?\e$B!#\e(B".force_encoding("ISO-2022-JP"), ""]
Iterates over keys and values. Note that unlike other collections, each
without block isn’t supported.