Indicated whether this Cipher
instance uses an Authenticated Encryption mode.
Parses a given string as a blob that contains configuration for OpenSSL
.
Parse the YAML
document contained in yaml
. Events will be called on the handler set on the parser instance.
See Psych::Parser
and Psych::Parser#handler
Starts the parser. init
is a data accumulator and is passed to the next event handler (as of Enumerable#inject
).
returns the timestamp as a time object.
ancillarydata should be one of following type:
SOL_SOCKET/SCM_TIMESTAMP (microsecond) GNU/Linux, FreeBSD, NetBSD, OpenBSD, Solaris, MacOS X
SOL_SOCKET/SCM_TIMESTAMPNS (nanosecond) GNU/Linux
SOL_SOCKET/SCM_BINTIME (2**(-64) second) FreeBSD
Addrinfo.udp
(“127.0.0.1”, 0).bind {|s1|
Addrinfo.udp("127.0.0.1", 0).bind {|s2| s1.setsockopt(:SOCKET, :TIMESTAMP, true) s2.send "a", 0, s1.local_address ctl = s1.recvmsg.last p ctl #=> #<Socket::AncillaryData: INET SOCKET TIMESTAMP 2009-02-24 17:35:46.775581> t = ctl.timestamp p t #=> 2009-02-24 17:35:46 +0900 p t.usec #=> 775581 p t.nsec #=> 775581000 }
}
returns array of WIN32OLE::Param
object corresponding with method parameters.
tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') method = WIN32OLE::Method.new(tobj, 'SaveAs') p method.params # => [Filename, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout]
Returns the type library version.
tlib = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library') puts tlib.version #-> "1.3"
Returns OLE variant type.
obj = WIN32OLE::Variant.new("string") obj.vartype # => WIN32OLE::VARIANT::VT_BSTR
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
Parse a raw cookie string into a hash of cookie-name=>Cookie pairs.
cookies = CGI::Cookie.parse("raw_cookie_string") # { "name1" => cookie1, "name2" => cookie2, ... }
Returns true
; retained for compatibility.
Creates a new Net::HTTP object, http
, via Net::HTTP.new:
For arguments address
and port
, see Net::HTTP.new
.
For proxy-defining arguments p_addr
through p_pass
, see Proxy Server.
For argument opts
, see below.
With no block given:
Calls http.start
with no block (see start
), which opens a TCP connection and HTTP session.
Returns http
.
The caller should call finish
to close the session:
http = Net::HTTP.start(hostname) http.started? # => true http.finish http.started? # => false
With a block given:
Calls http.start
with the block (see start
), which:
Opens a TCP connection and HTTP session.
Calls the block, which may make any number of requests to the host.
Closes the HTTP session and TCP connection on block exit.
Returns the block’s value object
.
Returns object
.
Example:
hostname = 'jsonplaceholder.typicode.com' Net::HTTP.start(hostname) do |http| puts http.get('/todos/1').body puts http.get('/todos/2').body end
Output:
{ "userId": 1, "id": 1, "title": "delectus aut autem", "completed": false } { "userId": 1, "id": 2, "title": "quis ut nam facilis et officia qui", "completed": false }
If the last argument given is a hash, it is the opts
hash, where each key is a method or accessor to be called, and its value is the value to be set.
The keys may include:
Note: If port
is nil
and opts[:use_ssl]
is a truthy value, the value passed to new
is Net::HTTP.https_default_port
, not port
.
Returns true
if the HTTP session has been started:
http = Net::HTTP.new(hostname) http.started? # => false http.start http.started? # => true http.finish # => nil http.started? # => false Net::HTTP.start(hostname) do |http| http.started? end # => true http.started? # => false
Starts an HTTP session.
Without a block, returns self
:
http = Net::HTTP.new(hostname) # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false> http.start # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=true> http.started? # => true http.finish
With a block, calls the block with self
, finishes the session when the block exits, and returns the block’s value:
http.start do |http| http end # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false> http.started? # => false
Sets the resolver timeouts. This may be a single positive number or an array of positive numbers representing timeouts in seconds. If an array is specified, a DNS
request will retry and wait for each successive interval in the array until a successful response is received. Specifying nil
reverts to the default timeouts:
Example:
dns.timeouts = 3