Skip to content

Commit 832b7f3

Browse files
committed
[ruby/csv] Add support for \r\n with skip_lines: /...$/ again
GitHub: fix GH-194 Reported by Josef Šimánek. Thanks!!! ruby/csv@fd86afe081
1 parent f993520 commit 832b7f3

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/csv/parser.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,7 @@ def skip_needless_lines
785785
end
786786

787787
def skip_line?(line)
788+
line = line.delete_suffix(@row_separator)
788789
case @skip_lines
789790
when String
790791
line.include?(@skip_lines)

test/csv/parse/test_skip_lines.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,10 @@ def test_empty_line_and_liberal_parsing
109109
:liberal_parsing => true,
110110
:skip_lines => /^$/))
111111
end
112+
113+
def test_crlf
114+
assert_equal([["a", "b"]],
115+
CSV.parse("a,b\r\n,\r\n",
116+
:skip_lines => /^,+$/))
117+
end
112118
end

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy