create
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (38)
- 2_6_3 (2)
- What's this?
create(basename="", tmpdir=nil, mode: 0, **options)
public
Creates a temporary file as usual File object (not Tempfile). It doesn’t use finalizer and delegation.
If no block is given, this is similar to Tempfile.new except creating File instead of Tempfile. The created file is not removed automatically. You should use File.unlink to remove it.
If a block is given, then a File object will be constructed, and the block is invoked with the object as the argument. The File object will be automatically closed and the temporary file is removed after the block terminates. The call returns the value of the block.
In any case, all arguments (basename, tmpdir, mode, and **options) will be treated as Tempfile.new.
Tempfile.create('foo', '/home/temp') do |f| ... do something with f ... end