-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use File.open with a block for simple exception handling and ensuring…
… files are closed (#476) With no associated block, `File.open` is a synonym for `File.new`. The `new` method returns a `File` instance that you can then read or write from. The file remains open until `close` is called on the instance. Once the file variable goes out of scope, then garbage collection will eventually close it, but this may not happen for a while. Meanwhile, resources are being held open. (From [Ruby 3.3: Opening and Closing Files](https://learning.oreilly.com/library/view/programming-ruby-3-3/9798888650684/f_0082.xhtml#d25e38151)) Resolves #475
- Loading branch information
Showing
3 changed files
with
12 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters