Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'tempfile'
- class FileWrapper
- def create_tempfile_with_a_block
- @file = Tempfile.new('foo')
- @file.close
- end
- def create_tempfile
- create_tempfile_with_a_block {}
- end
- end
- FileWrapper.new.create_tempfile
- GC.start
- file_count = ObjectSpace.each_object(FileWrapper){|o| puts o.inspect}
- puts "Expected 0 files, found #{file_count}"
Add Comment
Please, Sign In to add comment