Changes the parameters of the deflate stream to allow changes between different types of data that require different types of compression. Any unprocessed data is flushed before changing the params.
See Zlib::Deflate.new
for a description of level
and strategy
.
Returns last modification time recorded in the gzip file header.
Specify the modification time (mtime
) in the gzip header. Using an Integer
.
Setting the mtime in the gzip header does not effect the mtime of the file generated. Different utilities that expand the gzipped files may use the mtime header. For example the gunzip utility can use the ‘-N` flag which will set the resultant file’s mtime to the value in the header. By default many tools will set the mtime of the expanded file to the mtime of the gzipped file, not the mtime in the header.
If you do not set an mtime, the default value will be the time when compression started. Setting a value of 0 indicates no time stamp is available.
Returns the last access time for this file as an object of class Time
.
File.stat("testfile").atime #=> Wed Dec 31 18:00:00 CST 1969
Returns the modification time of stat.
File.stat("testfile").mtime #=> Wed Apr 09 08:53:14 CDT 2003
Returns the change time for stat (that is, the time directory information about the file was changed, not the file itself).
Note that on Windows (NTFS), returns creation time (birth time).
File.stat("testfile").ctime #=> Wed Apr 09 08:53:14 CDT 2003
Returns true
if stat has its sticky bit set, false
if it doesn’t or if the operating system doesn’t support this feature.
File.stat("testfile").sticky? #=> false
Extensions to build when installing the gem, specifically the paths to extconf.rb-style files used to compile extensions.
These files will be run when the gem is installed, causing the C (or whatever) code to be compiled on the user’s machine.
Usage:
spec.extensions << 'ext/rmagic/extconf.rb'
See Gem::Ext::Builder
for information about writing extensions for gems.
Activate this spec, registering it as a loaded spec and adding it’s lib paths to $LOAD_PATH. Returns true if the spec was activated, false if it was previously activated. Freaks out if there are conflicts upon activation.
Sets extensions to extensions
, ensuring it is an array. Don’t use this, push onto the array instead.
Set
the version to version
, potentially also setting required_rubygems_version
if version
indicates it is a prerelease.
Parse a raw cookie string into a hash of cookie-name=>Cookie pairs.
cookies = CGI::Cookie.parse("raw_cookie_string") # { "name1" => cookie1, "name2" => cookie2, ... }
A set of tasks to prepare the file in order to parse it
Returns the last modification time of the (remote) file. If local
is true
, it is returned as a local time, otherwise it’s a UTC time.
Turns on net/http 1.2 (Ruby 1.8) features. Defaults to ON in Ruby 1.8 or later.
Creates a new Net::HTTP
object, then additionally opens the TCP connection and HTTP
session.
Arguments are the following:
hostname or IP address of the server
port of the server
address of proxy
port of proxy
user of proxy
pass of proxy
optional hash
opt sets following values by its accessor. The keys are ipaddr, ca_file
, ca_path
, cert, cert_store
, ciphers, close_on_empty_response
, key, open_timeout
, read_timeout
, write_timeout
, ssl_timeout
, ssl_version
, use_ssl, verify_callback
, verify_depth
and verify_mode. If you set :use_ssl as true, you can use https and default value of verify_mode
is set as OpenSSL::SSL::VERIFY_PEER.
If the optional block is given, the newly created Net::HTTP
object is passed to it and closed when the block finishes. In this case, the return value of this method is the return value of the block. If no block is given, the return value of this method is the newly created Net::HTTP
object itself, and the caller is responsible for closing it upon completion using the finish() method.
Returns true if the HTTP
session has been started.
Opens a TCP connection and HTTP
session.
When this method is called with a block, it passes the Net::HTTP
object to the block, and closes the TCP connection and HTTP
session after the block has been executed.
When called with a block, it returns the return value of the block; otherwise, it returns self.
Sends a CAPABILITY command, and returns an array of capabilities that the server supports. Each capability is a string. See [IMAP] for a list of possible capabilities.
Note that the Net::IMAP
class does not modify its behaviour according to the capabilities of the server; it is up to the user of the class to ensure that a certain capability is supported by a server before using it.
Sends a STARTTLS command to start TLS session.
Sends an AUTHENTICATE command to authenticate the client. The auth_type
parameter is a string that represents the authentication mechanism to be used. Currently Net::IMAP
supports the authentication mechanisms:
LOGIN:: login using cleartext user and password. CRAM-MD5:: login with cleartext user and encrypted password (see [RFC-2195] for a full description). This mechanism requires that the server have the user's password stored in clear-text password.
For both of these mechanisms, there should be two args
: username and (cleartext) password. A server may not support one or the other of these mechanisms; check capability()
for a capability of the form “AUTH=LOGIN” or “AUTH=CRAM-MD5”.
Authentication is done using the appropriate authenticator object: see @@authenticators for more information on plugging in your own authenticator.
For example:
imap.authenticate('LOGIN', user, password)
A Net::IMAP::NoResponseError
is raised if authentication fails.