Is the object still in memory after it has been closed? If so, is that because garbage collection hasn’t kicked in yet? It looks like it was just marked as deleted rather than actually being gone from memory. This was produced in IRB, if that could affect it at all.
Thanks in advance!
1.9.3p125 :001 > f = File.open("myfile.txt", "r")
=> #<File:myfile.txt>
1.9.3p125 :002 > f
=> #<File:myfile.txt>
1.9.3p125 :002 > f.size
=> 122
1.9.3p125 :003 > f.close
=> nil
1.9.3p125 :004 > f
=> #<File:myfile.txt (closed)>
The object still exists in memory after you close the file. Your variable
fis holding a reference to it, so it can’t go away yet. Just like any other object, you’re still able to access it until all references to it go away.