From 8be9bd482eee91c503f623bb3b802c9fa8e371b2 Mon Sep 17 00:00:00 2001 From: naruse Date: Sat, 18 Mar 2017 12:02:27 +0000 Subject: merge revision(s) 57972: [Backport #13198] Fix bug of Tempfile#size if nothing is written [Bug #13198] * lib/tempfile.rb (Tempfile#size): Fix its behavior when nothing is written. Tempfile#size should return 0 in this case. The patch is from nobu . git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@58013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/tempfile.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/tempfile.rb') diff --git a/lib/tempfile.rb b/lib/tempfile.rb index 36b0e1a481..38d6e5ce24 100644 --- a/lib/tempfile.rb +++ b/lib/tempfile.rb @@ -227,7 +227,7 @@ class Tempfile < DelegateClass(File) if !@tmpfile.closed? @tmpfile.size # File#size calls rb_io_flush_raw() else - File.size?(@tmpfile.path) + File.size(@tmpfile.path) end end alias length size -- cgit v1.2.3