What happens when you run this code? ``` require 'pathname' require 'tempfile' def make_pathname(value = http://Tempfile.new ("log")) http://Pathname.new (value) end p = make_pathname FileUtils.touch(p) puts "File: #{p.file?}" GC.start puts "File: #{p.file?}" ```
I don't think that's a bug. I would be surprised if the name of a file retained the file
-
-
I'm surprised that passing a value to a Pathname object does not retain the object.
-
I think we disagree on the expected behavior here, but IMO the problem is that the behavior isn't obvious. What if there was a way that we could express this in the signature of the method. An "ownership" system, you might call it.
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.