Module: LinefeedFix

Defined in:
lib/linefeed_fix.rb

Overview

While the traditional linefeed in window is CR-LF vs LF in unix, excel seems to be generating spreadsheets with CR-CR-LF, which CSV.parse doesn't like.

Class Method Summary collapse

Class Method Details

.scrub!(string) ⇒ Object

Converts windows rn linefeeds to r also handles odd rrn seen at the end of some excel generated csvs


8
9
10
11
# File 'lib/linefeed_fix.rb', line 8

def self.scrub!(string)
  string.gsub!(/\r{0,1}\r\n/, "\n")
  string
end