Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove File.each_line method that returns an iterator #6301

Merged

Conversation

asterite
Copy link
Member

Fixes #6087

There's already IO#each_line which returns an iterator, so one can simply do:

File.open(filename) do |file|
  file.each_line.more_iterator_methods
end

and be sure the file is closed.

And I was wrong, there's no class method File.each_line in Ruby.

@sdogruyol sdogruyol merged commit fafdd63 into crystal-lang:master Jul 3, 2018
@RX14
Copy link
Contributor

RX14 commented Jul 3, 2018

I was waiting to merge this until after 0.25.2 since it's a breaking change.

@asterite asterite deleted the refactor/6087-remove-file-each-line branch July 6, 2018 22:56
vladfaust added a commit to vladfaust/migrate.cr that referenced this pull request Aug 14, 2018
BREAKING CHANGE: `File.each_line(path)` is no longer valid in Crystal since 0.26.

See crystal-lang/crystal#6301
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calling File.each_line Iterator method doesn't close File
3 participants