Class: Tempfile
Class Method Summary collapse
-
.open(*args) ⇒ Object
If no block is given, this is a synonym for new().
Instance Method Summary collapse
Class Method Details
.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 tempfile – in contrast to the original implementation, which returns nil.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/nuggets/tempfile/open.rb', line 40 def self.open(*args) tempfile = new(*args) if block_given? begin yield tempfile ensure tempfile.close end end tempfile end |
Instance Method Details
#_nuggets_original_open ⇒ Object
32 |
# File 'lib/nuggets/tempfile/open.rb', line 32 alias_method :_nuggets_original_open, :open |