This exception is raised if a generator or unparser error occurs.
This class is used as a return value from ObjectSpace::reachable_objects_from
.
When ObjectSpace::reachable_objects_from
returns an object with references to an internal object, an instance of this class is returned.
You can use the type
method to check the type of the internal object.
Subclasses ‘BadAlias` for backwards compatibility
YAML
event parser class. This class parses a YAML
document and calls events on the handler that is passed to the constructor. The events can be used for things such as constructing a YAML
AST or deserializing YAML
documents. It can even be fed back to Psych::Emitter
to emit the same document that was parsed.
See Psych::Handler
for documentation on the events that Psych::Parser
emits.
Here is an example that prints out ever scalar found in a YAML
document:
# Handler for detecting scalar values class ScalarHandler < Psych::Handler def scalar value, anchor, tag, plain, quoted, style puts value end end parser = Psych::Parser.new(ScalarHandler.new) parser.parse(yaml_document)
Here is an example that feeds the parser back in to Psych::Emitter
. The YAML
document is read from STDIN and written back out to STDERR:
parser = Psych::Parser.new(Psych::Emitter.new($stderr)) parser.parse($stdin)
Psych
uses Psych::Parser
in combination with Psych::TreeBuilder
to construct an AST of the parsed YAML
document.
Psych::Stream
is a streaming YAML
emitter. It will not buffer your YAML
, but send it straight to an IO
.
Here is an example use:
stream = Psych::Stream.new($stdout) stream.start stream.push({:foo => 'bar'}) stream.finish
YAML
will be immediately emitted to $stdout with no buffering.
Psych::Stream#start
will take a block and ensure that Psych::Stream#finish
is called, so you can do this form:
stream = Psych::Stream.new($stdout) stream.start do |em| em.push(:foo => 'bar') end
Socket::AncillaryData
represents the ancillary data (control information) used by sendmsg and recvmsg system call. It contains socket family
, control message (cmsg) level
, cmsg type
and cmsg data
.
Subclass of Zlib::Error
when zlib returns a Z_DATA_ERROR.
Usually if a stream was prematurely freed.
Zlib::ZStream
is the abstract class for the stream which handles the compressed data. The operations are defined in the subclasses: Zlib::Deflate
for compression, and Zlib::Inflate
for decompression.
An instance of Zlib::ZStream
has one stream (struct zstream in the source) and two variable-length buffers which associated to the input (next_in) of the stream and the output (next_out) of the stream. In this document, “input buffer” means the buffer for input, and “output buffer” means the buffer for output.
Data
input into an instance of Zlib::ZStream
are temporally stored into the end of input buffer, and then data in input buffer are processed from the beginning of the buffer until no more output from the stream is produced (i.e. until avail_out
> 0 after processing). During processing, output buffer is allocated and expanded automatically to hold all output data.
Some particular instance methods consume the data in output buffer and return them as a String
.
Here is an ascii art for describing above:
+================ an instance of Zlib::ZStream ================+ || || || +--------+ +-------+ +--------+ || || +--| output |<---------|zstream|<---------| input |<--+ || || | | buffer | next_out+-------+next_in | buffer | | || || | +--------+ +--------+ | || || | | || +===|======================================================|===+ | | v | "output data" "input data"
If an error occurs during processing input buffer, an exception which is a subclass of Zlib::Error
is raised. At that time, both input and output buffer keep their conditions at the time when the error occurs.
Method
Catalogue Many of the methods in this class are fairly low-level and unlikely to be of interest to users. In fact, users are unlikely to use this class directly; rather they will be interested in Zlib::Inflate
and Zlib::Deflate
.
The higher level methods are listed below.
Zlib::Deflate
is the class for compressing data. See Zlib::ZStream
for more information.
Zlib:Inflate is the class for decompressing compressed data. Unlike Zlib::Deflate
, an instance of this class is not able to duplicate (clone, dup) itself.
Objects of class File::Stat
encapsulate common status information for File
objects. The information is recorded at the moment the File::Stat
object is created; changes made to the file after that point will not be reflected. File::Stat
objects are returned by IO#stat
, File::stat
, File#lstat
, and File::lstat
. Many of these methods return platform-specific values, and not all values are meaningful on all systems. See also Kernel#test
.
Can be raised by IO
operations when IO#timeout=
is set.
The error thrown when the parser encounters illegal CSV
formatting.
Note: Don’t use this class directly. This is an internal class.
The DidYouMean::Formatter
is the basic, default formatter for the gem. The formatter responds to the message_for
method and it returns a human readable string.
The DidYouMean::Formatter
is the basic, default formatter for the gem. The formatter responds to the message_for
method and it returns a human readable string.
The DidYouMean::Formatter
is the basic, default formatter for the gem. The formatter responds to the message_for
method and it returns a human readable string.
Error raised by a dRuby protocol when it doesn’t support the scheme specified in a URI
. See DRb::DRbProtocol
.
Handler for sending and receiving drb messages.
This takes care of the low-level marshalling and unmarshalling of drb requests and responses sent over the wire between server and client. This relieves the implementor of a new drb protocol layer with having to deal with these details.
The user does not have to directly deal with this object in normal use.
Timer id conversion keeps objects alive for a certain amount of time after their last access. The default time period is 600 seconds and can be changed upon initialization.
To use TimerIdConv:
DRb.install_id_conv TimerIdConv.new 60 # one minute