Skip to content

2.5 --> 2.6: backwards incompatible change in #parse method for IOString #106

@BitOfUniverse

Description

@BitOfUniverse

If you call #seek(n) or #read(n) on StringIO object newer version of CSV.parse ignores current offset position in IO object.

Consider this examples
Ruby 2.5.5

require 'csv'
io = StringIO.new("#meta\na,b\n1,2")
io.read(6) # => "#meta\n"
CSV.parse(io) # => [["a", "b"], ["1", "2"]]

Ruby 2.6.3

io = StringIO.new("#meta\na,b\n1,2")
io.read(6) # => "#meta\n"
CSV.parse(io) # => [["#meta"], ["a", "b"], ["1", "2"]] (contains skipped data)

It looks that new logic always rewinds StringIO and there is now way to pass IO with specific offset position anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions