Actions
Bug #13198
closedTempfile#size is nil when nothing is written, expected 0
    Bug #13198:
    Tempfile#size is nil when nothing is written, expected 0
  
Description
require 'tempfile'
tmp = Tempfile.new
tmp.write ''
tmp.close
tmp.size # => nil
File.size(tmp.path) # => 0
I'm not sure if this is actually a bug, but this behavior really surprised me. I think it would be better to return 0 in this scenario instead of nil, which would match the behavior of File.
Actions