Returns an Array containing header converters; used for parsing; see Header Converters:
CSV.new('').header_converters # => []
The block need not return a String object:
csv = CSV.open(path, headers: true) csv.header_convert {|header, field_info| header.to_sym } table = csv.read table.headers # => [:Name, :Value]
If converter_name
is given, the block is not called:
csv = CSV.open(path, headers: true) csv.header_convert(:downcase) {|header, field_info| fail 'Cannot happen' } table = csv.read table.headers # => ["name", "value"]
Raises a parse-time exception if converter_name
is not the name of a built-in field converter:
csv = CSV.open(path, headers: true) csv.header_convert(:nosuch) # Raises NoMethodError (undefined method `arity' for nil:NilClass) csv.read
Processes fields
with @converters
, or @header_converters
if headers
is passed as true
, returning the converted field set. Any converter that changes the field into something other than a String
halts the pipeline of conversion for that field. This is primarily an efficiency shortcut.
Set
date-time format.
datetime_format
A string suitable for passing to strftime
.
Returns the date format being used. See datetime_format=
Creates a single-row matrix where the values of that row are as given in row
.
Matrix.row_vector([4,5,6]) # => 4 5 6
Creates a single-column matrix where the values of that column are as given in column
.
Matrix.column_vector([4,5,6]) # => 4 # 5 # 6
Returns the number of rows.
Called for dup & clone.
Returns an array of the row vectors of the matrix. See Vector
.
Returns an array of the column vectors of the matrix. See Vector
.
Called for dup & clone.
Add option switch like with on
, but at head of summary.
Add option switch like with on
, but at tail of summary.
Closes the incoming port and returns its previous state. All further attempts to Ractor.receive
in the ractor, and send
to the ractor will fail with Ractor::ClosedError
.
r = Ractor.new {sleep(500)} r.close_incoming #=> false r.close_incoming #=> true r.send('test') # Ractor::ClosedError (The incoming-port is already closed)
Returns the number of threads waiting on the queue.
Returns the number of threads waiting on the queue.
Removes tracing for the specified command on the given global variable and returns nil
. If no command is specified, removes all tracing for that variable and returns an array containing the commands actually removed.