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 oject 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.
# File lib/tempfile.rb, line 315 def open(*args) tempfile = new(*args) if block_given? begin yield(tempfile) ensure tempfile.close end else tempfile end end