This class works in conjunction with Psych::Parser
to build an in-memory parse tree that represents a YAML
document.
parser = Psych::Parser.new Psych::TreeBuilder.new parser.parse('--- foo') tree = parser.handler.root
See Psych::Handler
for documentation on the event methods used in this class.
Subclass of Zlib::Error
. This error is raised when the zlib stream is currently in progress.
For example:
inflater = Zlib::Inflate.new inflater.inflate(compressed) do inflater.inflate(compressed) # Raises Zlib::InProgressError end
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.
Zlib::GzipWriter
is a class for writing gzipped files. GzipWriter
should be used with an instance of IO
, or IO-like, object.
Following two example generate the same result.
Zlib::GzipWriter.open('hoge.gz') do |gz| gz.write 'jugemu jugemu gokou no surikire...' end File.open('hoge.gz', 'w') do |f| gz = Zlib::GzipWriter.new(f) gz.write 'jugemu jugemu gokou no surikire...' gz.close end
To make like gzip(1) does, run following:
orig = 'hoge.txt' Zlib::GzipWriter.open('hoge.gz') do |gz| gz.mtime = File.mtime(orig) gz.orig_name = orig gz.write IO.binread(orig) end
NOTE: Due to the limitation of Ruby’s finalizer, you must explicitly close GzipWriter
objects by Zlib::GzipWriter#close
etc. Otherwise, GzipWriter
will be not able to write the gzip footer and will generate a broken gzip file.
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
.
exception to wait for reading by EWOULDBLOCK. see IO.select
.
exception to wait for writing by EWOULDBLOCK. see IO.select
.
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.
spell checker for a dictionary that has a tree structure, see doc/tree_spell_checker_api.md
An entry in an ACL
Error raised by the DRbProtocol
module when it cannot find any protocol implementation support the scheme specified in a URI
.
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
Raised when the provided IP address is an invalid address.
Raised when the address is an invalid length.
This class is the base class for Net::HTTP request classes. The class should not be used directly; instead you should use its subclasses, listed below.
An request object may be created with either a URI
or a string hostname:
require 'net/http' uri = URI('https://jsonplaceholder.typicode.com/') req = Net::HTTP::Get.new(uri) # => #<Net::HTTP::Get GET> req = Net::HTTP::Get.new(uri.hostname) # => #<Net::HTTP::Get GET>
And with any of the subclasses:
req = Net::HTTP::Head.new(uri) # => #<Net::HTTP::Head HEAD> req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST> req = Net::HTTP::Put.new(uri) # => #<Net::HTTP::Put PUT> # ...
The new instance is suitable for use as the argument to Net::HTTP#request
.
A new request object has these header fields by default:
req.to_hash # => {"accept-encoding"=>["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"], "accept"=>["*/*"], "user-agent"=>["Ruby"], "host"=>["jsonplaceholder.typicode.com"]}
See:
You can add headers or override default headers:
# res = Net::HTTP::Get.new(uri, {'foo' => '0', 'bar' => '1'})
This class (and therefore its subclasses) also includes (indirectly) module Net::HTTPHeader
, which gives access to its methods for setting headers.
Subclasses for HTTP requests:
Subclasses for WebDAV requests:
Parent class for informational (1xx) HTTP
response classes.
An informational response indicates that the request was received and understood.
References:
Response class for Continue
responses (status code 100).
A Continue
response indicates that the server has received the request headers.
References:
Response class for Early Hints
responses (status code 103).
The Early Hints
indicates that the server has received and is processing the request, and contains certain headers; the final response is not available yet.
References: