< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Feature #1999: Improved Tempfile
http://redmine.ruby-lang.org/issues/show/1999
Author: Hongli Lai
Status: Open, Priority: Normal
Category: lib
I've written an improved version of Tempfile. The changes are as follows:
- Much better documentation.
- A large unit test suite to prevent future regressions.
- Fixes a bug in the finalizer: if one calls #unlink on a Tempfile, then recreates the same file outside Ruby, and then runs the garbage collector, then the Tempfile's finalizer will delete the newly created file even when it's not supposed to:
t = Tempfile.new('foo')
path = t.path
t.close
t.unlink
system("touch #{path}")
exit # Run finalizers
# => The file as referred to by 'path' doesn't exist anymore.
The source code can be found here:
http://github.com/FooBarWidget/better/blob/232a0a4f68dab7950c06390fddb940e7af1ff607/lib/better/tempfile.rb
It's compatible with both 1.8 and 1.9.
The tests are here:
http://github.com/FooBarWidget/better/blob/232a0a4f68dab7950c06390fddb940e7af1ff607/test/tempfile_test.rb
http://github.com/FooBarWidget/better/blob/232a0a4f68dab7950c06390fddb940e7af1ff607/test/tempfile_unlink_on_exit_example.rb
http://github.com/FooBarWidget/better/blob/232a0a4f68dab7950c06390fddb940e7af1ff607/test/tempfile_explicit_unlink_example.rb
http://github.com/FooBarWidget/better/blob/232a0a4f68dab7950c06390fddb940e7af1ff607/test/tempfile_explicit_close_and_unlink_example.rb
----------------------------------------
http://redmine.ruby-lang.org