def self.build_csv_interface
Object.const_set(:CSV, Class.new).class_eval do
def self.foreach(path, rs = :auto, &block)
FasterCSV.foreach(path, :row_sep => rs, &block)
end
def self.generate_line(row, fs = ",", rs = "")
FasterCSV.generate_line(row, :col_sep => fs, :row_sep => rs)
end
def self.open(path, mode, fs = ",", rs = :auto, &block)
if block and mode.include? "r"
FasterCSV.open(path, mode, :col_sep => fs, :row_sep => rs) do |csv|
csv.each(&block)
end
else
FasterCSV.open(path, mode, :col_sep => fs, :row_sep => rs, &block)
end
end
def self.parse(str_or_readable, fs = ",", rs = :auto, &block)
FasterCSV.parse(str_or_readable, :col_sep => fs, :row_sep => rs, &block)
end
def self.parse_line(src, fs = ",", rs = :auto)
FasterCSV.parse_line(src, :col_sep => fs, :row_sep => rs)
end
def self.readlines(path, rs = :auto)
FasterCSV.readlines(path, :row_sep => rs)
end
end
end