Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > csvライブラリ > CSVクラス > filter

singleton method CSV.filter

filter(options = Hash.new) {|row| ... }
filter(input, options = Hash.new) {|row| ... }
filter(input, output, options = Hash.new) {|row| ... }

このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築するのに便利です。

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.

[PARAM] input:
StringIO のインスタンスを指定します。 デフォルトは ARGF です。
[PARAM] output:
StringIO のインスタンスを指定します。 デフォルトは $stdout です。
[PARAM] options:
":in_", ":input_" で始まるキーは input にだけ適用されます。 ":out_", ":output_" で始まるキーは output にだけ適用されます。 それ以外のキーは両方に適用されます。 ":output_row_sep" のデフォルト値は $/ です。

[SEE_ALSO] CSV.new