mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/csv] Add support for \r\n with skip_lines: /...$/ again
GitHub: fix GH-194 Reported by Josef Šimánek. Thanks!!! https://github.com/ruby/csv/commit/fd86afe081
This commit is contained in:
parent
f9935205ac
commit
832b7f3c54
Notes:
git
2020-11-24 09:34:25 +09:00
2 changed files with 7 additions and 0 deletions
|
@ -785,6 +785,7 @@ class CSV
|
|||
end
|
||||
|
||||
def skip_line?(line)
|
||||
line = line.delete_suffix(@row_separator)
|
||||
case @skip_lines
|
||||
when String
|
||||
line.include?(@skip_lines)
|
||||
|
|
|
@ -109,4 +109,10 @@ class TestCSVParseSkipLines < Test::Unit::TestCase
|
|||
:liberal_parsing => true,
|
||||
:skip_lines => /^$/))
|
||||
end
|
||||
|
||||
def test_crlf
|
||||
assert_equal([["a", "b"]],
|
||||
CSV.parse("a,b\r\n,\r\n",
|
||||
:skip_lines => /^,+$/))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue