filter( input, options = Hash.new ) { |row| ... }
filter( input, output, options = Hash.new ) { |row| ... }
This method is a convenience for building Unix-like filters for CSV data. Each row is yielded to the provided block
which can alter it as needed. After the block returns, the row is appended
to output
altered or not.
The input
and output
arguments can be anything ::new accepts (generally String or IO objects). If not given, they default to
ARGF
and $stdout
.
The options
parameter is also filtered down to ::new after some clever key parsing. Any
key beginning with :in_
or :input_
will have that
leading identifier stripped and will only be used in the
options
Hash for the
input
object. Keys starting with :out_
or
:output_
affect only output
. All other keys are
assigned to both objects.
The :output_row_sep
option
defaults to
$INPUT_RECORD_SEPARATOR
($/
).
Please login to continue.