class Tempfile

Public Class Methods

_nuggets_original_open(*args)
Alias for: open
open(*args) { |tempfile| ... } click to toggle source

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.

# File lib/nuggets/tempfile/open.rb, line 41
def open(*args)
  tempfile = new(*args)

  if block_given?
    begin
      yield tempfile
    ensure
      tempfile.close
    end
  end

  tempfile
end
Also aliased as: _nuggets_original_open