Given the following code:
file = File.new('file1.txt', 'w')
# write data to the file
File.new method executes a call to
IO::new (docs here).
The thing being "opened" in this case is an input/output stream which Ruby tracks using file descriptors. These file descriptors can be expensive to keep around which is why its good practice to call the
close method on any instances of