Method: BugFix::Tempfile.open
- Defined in:
- lib/pik/contrib/zip/tempfile_bugfixed.rb
.open(*args) ⇒ Object
If no block is given, this is a synonym for new().
If a block is given, it will be passed tempfile as an argument, and the tempfile will automatically be closed when the block terminates. In this case, open() returns nil.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/pik/contrib/zip/tempfile_bugfixed.rb', line 168 def open(*args) tempfile = new(*args) if block_given? begin yield(tempfile) ensure tempfile.close end nil else tempfile end end |