method
open
v2_1_10 -
Show latest stable
-
0 notes -
Class: Tempfile
- 1_8_6_287 (0)
- 1_8_7_72 (0)
- 1_8_7_330 (0)
- 1_9_1_378 (0)
- 1_9_2_180 (23)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
open(*args)
public
If no block is given, this is a synonym for Tempfile.new.
If a block is given, then a Tempfile object will be constructed, and the block is run with said object as argument. The Tempfile object will be automatically closed after the block terminates. The call returns the value of the block.
In any case, all arguments (+*args+) will be passed to Tempfile.new.
Tempfile.open('foo', '/home/temp') do |f| ... do something with f ... end # Equivalent: f = Tempfile.open('foo', '/home/temp') begin ... do something with f ... ensure f.close end