General error for openssl library configuration files. Including formatting, parsing errors, etc.
Document-class: OpenSSL::HMAC
OpenSSL::HMAC
allows computing Hash-based Message Authentication Code (HMAC
). It is a type of message authentication code (MAC) involving a hash function in combination with a key. HMAC
can be used to verify the integrity of a message as well as the authenticity.
OpenSSL::HMAC
has a similar interface to OpenSSL::Digest
.
key = "key" data = "message-to-be-authenticated" mac = OpenSSL::HMAC.hexdigest("SHA256", key, data) #=> "cddb0db23f469c8bf072b21fd837149bd6ace9ab771cceef14c9e517cc93282e"
data1 = File.binread("file1") data2 = File.binread("file2") key = "key" hmac = OpenSSL::HMAC.new(key, 'SHA256') hmac << data1 hmac << data2 mac = hmac.digest
The superclass for all exceptions raised by Ruby/zlib.
The following exceptions are defined as subclasses of Zlib::Error
. These exceptions are raised when zlib library functions return with an error status.
Subclass of Zlib::Error
when zlib returns a Z_DATA_ERROR.
Usually if a stream was prematurely freed.
Subclass of Zlib::Error
When zlib returns a Z_STREAM_ERROR, usually if the stream state was inconsistent.
Subclass of Zlib::Error
When zlib returns a Z_MEM_ERROR, usually if there was not enough memory.
Subclass of Zlib::Error
when zlib returns a Z_BUF_ERROR.
Usually if no progress is possible.
Subclass of Zlib::Error
When zlib returns a Z_VERSION_ERROR, usually if the zlib library version is incompatible with the version assumed by the caller.
Zlib::GzipReader
is the class for reading a gzipped file. GzipReader
should be used as an IO
, or -IO-like, object.
Zlib::GzipReader.open('hoge.gz') {|gz| print gz.read } File.open('hoge.gz') do |f| gz = Zlib::GzipReader.new(f) print gz.read gz.close end
Method
Catalogue The following methods in Zlib::GzipReader
are just like their counterparts in IO
, but they raise Zlib::Error
or Zlib::GzipFile::Error
exception if an error was found in the gzip file.
Be careful of the footer of the gzip file. A gzip file has the checksum of pre-compressed data in its footer. GzipReader
checks all uncompressed data against that checksum at the following cases, and if it fails, raises Zlib::GzipFile::NoFooter
, Zlib::GzipFile::CRCError
, or Zlib::GzipFile::LengthError
exception.
When an reading request is received beyond the end of file (the end of compressed data). That is, when Zlib::GzipReader#read
, Zlib::GzipReader#gets
, or some other methods for reading returns nil.
When Zlib::GzipFile#close
method is called after the object reaches the end of file.
When Zlib::GzipReader#unused
method is called after the object reaches the end of file.
The rest of the methods are adequately described in their own documentation.
exception to wait for reading by EWOULDBLOCK. see IO.select
.
exception to wait for writing by EWOULDBLOCK. see IO.select
.
The error thrown when the parser encounters illegal CSV
formatting.
A CSV::Row instance represents a CSV table row. (see class CSV).
The instance may have:
Fields: each is an object, not necessarily a String.
Headers: each serves a key, and also need not be a String.
CSV::Row has three groups of instance methods:
Its own internally defined instance methods.
Methods included by module Enumerable
.
Methods delegated to class Array
.:
Commonly, a new CSV::Row instance is created by parsing CSV source that has headers:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.each {|row| p row }
Output:
#<CSV::Row "Name":"foo" "Value":"0"> #<CSV::Row "Name":"bar" "Value":"1"> #<CSV::Row "Name":"baz" "Value":"2">
You can also create a row directly. See ::new
.
Like a CSV::Table, a CSV::Row has headers.
A CSV::Row that was created by parsing CSV source inherits its headers from the table:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) row = table.first row.headers # => ["Name", "Value"]
You can also create a new row with headers; like the keys in a Hash, the headers need not be Strings:
row = CSV::Row.new([:name, :value], ['foo', 0]) row.headers # => [:name, :value]
The new row retains its headers even if added to a table that has headers:
table << row # => #<CSV::Table mode:col_or_row row_count:5> row.headers # => [:name, :value] row[:name] # => "foo" row['Name'] # => nil
You may access a field in a CSV::Row with either its Integer index (Array-style) or its header (Hash-style).
Fetch a field using method []
:
row = CSV::Row.new(['Name', 'Value'], ['foo', 0]) row[1] # => 0 row['Value'] # => 0
row = CSV::Row.new(['Name', 'Value'], ['foo', 0]) row # => #<CSV::Row "Name":"foo" "Value":0> row[0] = 'bar' row['Value'] = 1 row # => #<CSV::Row "Name":"bar" "Value":1>
Superclass of all errors raised in the DRb
module.
Error raised when an error occurs on the underlying communication protocol.
An exception wrapping a DRb::DRbUnknown
object
An exception wrapping an error object
The default drb protocol which communicates over a TCP socket.
The DRb
TCP protocol URI
looks like: druby://<host>:<port>?<option>
. The option is optional.
The protocol for DRb
over an SSL socket
The URI
for a DRb
socket over SSL is: drbssl://<host>:<port>?<option>
. The option is optional
Implements DRb
over a UNIX socket
DRb
UNIX socket URIs look like drbunix:<path>?<option>
. The option is optional.
Error
types.