mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/csv.rb: Fixing a bug that prevented CSV from parsing
all multi-line fields correctly. Patch by Rob Biedenham. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
89a3e2ed7a
commit
effa0c76d9
3 changed files with 29 additions and 2 deletions
10
lib/csv.rb
10
lib/csv.rb
|
@ -198,7 +198,7 @@ require "stringio"
|
|||
#
|
||||
class CSV
|
||||
# The version of the installed library.
|
||||
VERSION = "2.4.6".freeze
|
||||
VERSION = "2.4.7".freeze
|
||||
|
||||
#
|
||||
# A CSV::Row is part Array and part Hash. It retains an order for the fields
|
||||
|
@ -1843,7 +1843,13 @@ class CSV
|
|||
end
|
||||
|
||||
parts = parse.split(@col_sep, -1)
|
||||
csv << nil if parts.empty?
|
||||
if parts.empty?
|
||||
if in_extended_col
|
||||
csv[-1] << @col_sep # will be replaced with a @row_sep after the parts.each loop
|
||||
else
|
||||
csv << nil
|
||||
end
|
||||
end
|
||||
|
||||
# This loop is the hot path of csv parsing. Some things may be non-dry
|
||||
# for a reason. Make sure to benchmark when refactoring.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue