Results for: "OptionParser"

Protected setter for the host component v.

See also URI::Generic.host=.

Protected setter for the port component v.

See also URI::Generic.port=.

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.

Returns an Array of the path split on ‘/’.

Private setter for dn val.

Private setter for attributes val.

Private setter for to v.

Constructs the default Hash of Regexp’s.

Constructs the default Hash of Regexp’s.

Calls the given block once for each key, value pair in the database.

Returns self.

Invoked by IO#wait, IO#wait_readable, IO#wait_writable to ask whether the specified descriptor is ready for specified events within the specified timeout.

events is a bit mask of IO::READABLE, IO::WRITABLE, and IO::PRIORITY.

Suggested implementation should register which Fiber is waiting for which resources and immediately calling Fiber.yield to pass control to other fibers. Then, in the close method, the scheduler might dispatch all the I/O resources to fibers waiting for it.

Expected to return the subset of events that are ready immediately.

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#write or IO::Buffer#write to write length bytes to io from from a specified buffer (see IO::Buffer) at the given offset.

The length argument is the “minimum length to be written”. If the IO buffer size is 8KiB, but the length specified is 1024 (1KiB), at most 8KiB will be written, but at least 1KiB will be. Generally, the only case where less data than length will be written is if there is an error writing the data.

Specifying a length of 0 is valid and means try writing at least once, as much data as possible.

Suggested implementation should try to write to 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 get data from buffer efficiently.

Expected to return number of bytes written, 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#pwrite or IO::Buffer#pwrite to write length bytes to io at offset from into a specified buffer (see IO::Buffer) at the given offset.

This method is semantically the same as io_write, but it allows to specify the offset to write to and is often better for asynchronous IO on the same file.

The method should be considered experimental.

Invoked by Kernel#sleep and Mutex#sleep and is expected to provide an implementation of sleeping in a non-blocking way. Implementation might register the current fiber in some list of “which fiber wait until what moment”, call Fiber.yield to pass control, and then in close resume the fibers whose wait period has elapsed.

Returns the number of threads waiting on the queue.

Returns the number of threads waiting on the queue.

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

Returns true if the invalid byte sequence error is caused by premature end of string.

ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")

begin
  ec.convert("abc\xA1z")
rescue Encoding::InvalidByteSequenceError
  p $!      #=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "z" on EUC-JP>
  p $!.incomplete_input?    #=> false
end

begin
  ec.convert("abc\xA1")
  ec.finish
rescue Encoding::InvalidByteSequenceError
  p $!      #=> #<Encoding::InvalidByteSequenceError: incomplete "\xA1" on EUC-JP>
  p $!.incomplete_input?    #=> true
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

Returns an exception object for the last conversion. Returns nil if the last conversion did not produce an error.

“error” means that Encoding::InvalidByteSequenceError and Encoding::UndefinedConversionError for Encoding::Converter#convert and :invalid_byte_sequence, :incomplete_input and :undefined_conversion for Encoding::Converter#primitive_convert.

ec = Encoding::Converter.new("utf-8", "iso-8859-1")
p ec.primitive_convert(src="\xf1abcd", dst="")       #=> :invalid_byte_sequence
p ec.last_error      #=> #<Encoding::InvalidByteSequenceError: "\xF1" followed by "a" on UTF-8>
p ec.primitive_convert(src, dst, nil, 1)             #=> :destination_buffer_full
p ec.last_error      #=> nil

Iterates over keys and values. Note that unlike other collections, each without block isn’t supported.

No documentation available

Similar to read, but raises EOFError at end of string unless the +exception: false+ option is passed in.

Search took: 8ms  ·  Total Results: 5424