Returns the internal encoding for strings read from ARGF
as an Encoding
object.
If ARGF.set_encoding
has been called with two encoding names, the second is returned. Otherwise, if Encoding.default_external
has been set, that value is returned. Failing that, if a default external encoding was specified on the command-line, that value is used. If the encoding is unknown, nil
is returned.
This method is a shortcut for converting a single row (Array) into a CSV
String.
The options
parameter can be anything CSV::new()
understands. This method understands an additional :encoding
parameter to set the base Encoding
for the output. This method will try to guess your Encoding
from the first non-nil
field in row
, if possible, but you may need to use this parameter as a backup plan.
The :row_sep
option
defaults to $INPUT_RECORD_SEPARATOR
($/
) when calling this method.
This method is a shortcut for converting a single line of a CSV
String into an Array. Note that if line
contains multiple rows, anything beyond the first row is ignored.
The options
parameter can be anything CSV::new()
understands.
Returns true
if illegal input is handled. See CSV::new
for details.
Pre-compiles parsers and stores them by name for access during reads.
Stores the pattern of comments to skip from the provided options.
The pattern must respond to .match
, else ArgumentError
is raised. Strings are converted to a Regexp
.
See also CSV.new
This method is used to turn a finished row
into a CSV::Row
. Header rows are also dealt with here, either by returning a CSV::Row
with identical headers and fields (save that the fields do not go through the converters) or by reading past them to return a field row. Headers are also saved in @headers
for use in future rows.
When nil
, row
is assumed to be a header row not based on an actual row of the stream.
Return the appropriate error message in POSIX-defined format. If no error has occurred, returns nil.
Returns a string for DNS reverse lookup compatible with RFC3172.
Returns the Laplace expansion along given row or column.
Matrix[[7,6], [3,9]].laplace_expansion(column: 1) => 45 Matrix[[Vector[1, 0], Vector[0, 1]], [2, 3]].laplace_expansion(row: 0) => Vector[3, -2]
Private. Use Matrix#determinant
Returns the determinant of the matrix, using Bareiss’ multistep integer-preserving gaussian elimination. It has the same computational cost order O(n^3) as standard Gaussian elimination. Intermediate results are fraction free and of lower complexity. A matrix of Integers will have thus intermediate results that are also Integers, with smaller bignums (if any), while a matrix of Float
will usually have intermediate results with better precision.
Returns an angle with another vector. Result is within the [0…Math::PI].
Vector[1,0].angle_with(Vector[0,1]) # => Math::PI / 2