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.
exception to wait for reading by EAGAIN. see IO.select
.
exception to wait for writing by EAGAIN. see IO.select
.
exception to wait for reading by EWOULDBLOCK. see IO.select
.
exception to wait for writing by EWOULDBLOCK. see IO.select
.
exception to wait for reading by EINPROGRESS. see IO.select
.
exception to wait for writing by EINPROGRESS. see IO.select
.
A CSV::Table instance represents CSV data. (see class CSV).
The instance may have:
Rows: each is a Table::Row object.
Headers: names for the columns.
CSV::Table 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::Table instance is created by parsing CSV source using headers:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.class # => CSV::Table
You can also create an instance directly. See ::new
.
If a table has headers, the headers serve as labels for the columns of data. Each header serves as the label for its column.
The headers for a CSV::Table object are stored as an Array of Strings.
Commonly, headers are defined in the first row of CSV source:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.headers # => ["Name", "Value"]
If no headers are defined, the Array is empty:
table = CSV::Table.new([]) table.headers # => []
CSV::Table provides three modes for accessing table data:
Row mode.
Column mode.
Mixed mode (the default for a new table).
The access mode for aCSV::Table instance affects the behavior of some of its instance methods:
Set
a table to row mode with method by_row!
:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.by_row! # => #<CSV::Table mode:row row_count:4>
Specify a single row by an Integer index:
# Get a row. table[1] # => #<CSV::Row "Name":"bar" "Value":"1"> # Set a row, then get it. table[1] = CSV::Row.new(['Name', 'Value'], ['bam', 3]) table[1] # => #<CSV::Row "Name":"bam" "Value":3>
Specify a sequence of rows by a Range:
# Get rows. table[1..2] # => [#<CSV::Row "Name":"bam" "Value":3>, #<CSV::Row "Name":"baz" "Value":"2">] # Set rows, then get them. table[1..2] = [ CSV::Row.new(['Name', 'Value'], ['bat', 4]), CSV::Row.new(['Name', 'Value'], ['bad', 5]), ] table[1..2] # => [["Name", #<CSV::Row "Name":"bat" "Value":4>], ["Value", #<CSV::Row "Name":"bad" "Value":5>]]
Set
a table to column mode with method by_col!
:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.by_col! # => #<CSV::Table mode:col row_count:4>
Specify a column by an Integer index:
# Get a column. table[0] # Set a column, then get it. table[0] = ['FOO', 'BAR', 'BAZ'] table[0] # => ["FOO", "BAR", "BAZ"]
Specify a column by its String header:
# Get a column. table['Name'] # => ["FOO", "BAR", "BAZ"] # Set a column, then get it. table['Name'] = ['Foo', 'Bar', 'Baz'] table['Name'] # => ["Foo", "Bar", "Baz"]
In mixed mode, you can refer to either rows or columns:
An Integer index refers to a row.
A Range index refers to multiple rows.
A String index refers to a column.
Set
a table to mixed mode with method by_col_or_row!
:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.by_col_or_row! # => #<CSV::Table mode:col_or_row row_count:4>
Specify a single row by an Integer index:
# Get a row. table[1] # => #<CSV::Row "Name":"bar" "Value":"1"> # Set a row, then get it. table[1] = CSV::Row.new(['Name', 'Value'], ['bam', 3]) table[1] # => #<CSV::Row "Name":"bam" "Value":3>
Specify a sequence of rows by a Range:
# Get rows. table[1..2] # => [#<CSV::Row "Name":"bam" "Value":3>, #<CSV::Row "Name":"baz" "Value":"2">] # Set rows, then get them. table[1] = CSV::Row.new(['Name', 'Value'], ['bat', 4]) table[2] = CSV::Row.new(['Name', 'Value'], ['bad', 5]) table[1..2] # => [["Name", #<CSV::Row "Name":"bat" "Value":4>], ["Value", #<CSV::Row "Name":"bad" "Value":5>]]
Specify a column by its String header:
# Get a column. table['Name'] # => ["foo", "bat", "bad"] # Set a column, then get it. table['Name'] = ['Foo', 'Bar', 'Baz'] table['Name'] # => ["Foo", "Bar", "Baz"]
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.
Raised when the provided IP address is an invalid address.
Default formatter for log messages.
Parent class for informational (1xx) HTTP
response classes.
An informational response indicates that the request was received and understood.
References:
Response class for Created
responses (status code 201).
The Created
response indicates that the server has received and has fulfilled a request to create a new resource.
References:
Response class for Method Not Allowed
responses (status code 405).
The request method is not supported for the requested resource.
References:
Response class for Proxy Authentication Required
responses (status code 407).
The client must first authenticate itself with the proxy.
References:
Response class for Unsupported Media Type
responses (status code 415).
The request entity has a media type which the server or resource does not support.
References:
Response class for Range Not Satisfiable
responses (status code 416).
The request entity has a media type which the server or resource does not support.
References: