Class: Puppet::FileSystem::Tempfile

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/file_system/tempfile.rb

Class Method Summary collapse

Class Method Details

.open(identifier) {|file| ... } ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Variation of Tempfile.open which ensures that the tempfile is closed and unlinked before returning

Parameters:

  • identifier (String)

    additional part of generated pathname

Yield Parameters:

  • file (File)

    the temporary file object

Returns:

  • result of the passed block



12
13
14
15
16
17
18
19
# File 'lib/puppet/file_system/tempfile.rb', line 12

def self.open(identifier)
  file = ::Tempfile.new(identifier)

  yield file

ensure
  file.close!
end