# File lib/csvparser.rb, line 36 def parse( string, space = false, sepalator = ',' ) in_field = :IN_FIELD in_qfield = :IN_QFIELD status = in_field csv = string.split // parsed = [] char = index = nil line = '' csv.each_with_index do | char, index | case status when in_field case char when '"' line << char status = in_qfield when "\r" unless csv[index+1] == "\n" then parsed << _parse_line(line,space,sepalator) unless line.empty? line = '' end when "\n" parsed << _parse_line(line,space,sepalator) unless line.empty? line = '' else line << char end when in_qfield case char when '"' line << char status = in_field else line << char end end end parsed << _parse_line(line,space,sepalator) unless line.empty? parsed end