def self.filter(*args)
in_options, out_options = Hash.new, {:row_sep => $INPUT_RECORD_SEPARATOR}
if args.last.is_a? Hash
args.pop.each do |key, value|
case key.to_s
when /\Ain(?:put)?_(.+)\Z/
in_options[$1.to_sym] = value
when /\Aout(?:put)?_(.+)\Z/
out_options[$1.to_sym] = value
else
in_options[key] = value
out_options[key] = value
end
end
end
input = FasterCSV.new(args.shift || ARGF, in_options)
output = FasterCSV.new(args.shift || $stdout, out_options)
input.each do |row|
yield row
output << row
end
end