Skip to content

Keep the arguments of GzipReader#each_line when returning an enumerator - #179

Open
segiddins wants to merge 1 commit into
ruby:masterfrom
segiddins:segiddins/gzreader-each-line-enumerator
Open

segiddins wants to merge 1 commit into
ruby:masterfrom
segiddins:segiddins/gzreader-each-line-enumerator

Conversation

@segiddins

Copy link
Copy Markdown
Contributor

rb_gzreader_each created the enumerator with RETURN_ENUMERATOR(obj, 0, 0), so each_line(sep, limit) without a block iterated with the default separator and no limit.

gz = Zlib.gzip("a,b,c\nd,e\n")
Zlib::GzipReader.new(StringIO.new(gz)).each_line(",").to_a
# expected: ["a,", "b,", "c\nd,", "e\n"]
# actual:   ["a,b,c\n", "d,e\n"]

rb_gzreader_each created the enumerator with RETURN_ENUMERATOR(obj, 0, 0), so each_line(sep, limit) without a block iterated with the default separator and no limit.

```ruby
gz = Zlib.gzip("a,b,c\nd,e\n")
Zlib::GzipReader.new(StringIO.new(gz)).each_line(",").to_a
# expected: ["a,", "b,", "c\nd,", "e\n"]
# actual:   ["a,b,c\n", "d,e\n"]
```

Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant