summaryrefslogtreecommitdiff
path: root/lib/tempfile.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-06-04 07:34:19 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-06-04 07:34:19 +0000
commitb7bc0cae539617af4dfac5b44b0ebd700efe2084 (patch)
treea65171fc36999a1cc3c537a0b8bf62ddd9b16f77 /lib/tempfile.rb
parent4cb164ee2a30ecb59ce93670e569f384c7da7521 (diff)
* string.c (rb_str_aset): should raise error if an indexing string
is not found in the receiver. * sprintf.c (rb_f_sprintf): "%d" should convert objects into integers using Integer(). * lib/tempfile.rb (Tempfile::size): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/tempfile.rb')
-rw-r--r--lib/tempfile.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index a0c7f4cf3f..fd03b2ccc8 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -85,6 +85,15 @@ class Tempfile < SimpleDelegator
def path
@tmpname
end
+
+ def size
+ if @tmpfile
+ @tmpfile.flush
+ @tmpfile.stat.size
+ else
+ 0
+ end
+ end
end
if __FILE__ == $0