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

method #close doesn't exists for File class #171

Open
hoblin opened this issue Jul 2, 2018 · 0 comments
Open

method #close doesn't exists for File class #171

hoblin opened this issue Jul 2, 2018 · 0 comments

Comments

@hoblin
Copy link

hoblin commented Jul 2, 2018

When you open file in Ruby using File.open with block, file closes automatically.

File.open(...){ |f| f << something }

You need to close file only if you use open without block. It this case open is just synonym for new

f = File.open(...)
f << something
f.close
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

No branches or pull requests

1 participant