Class: Tempfile::Remover

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Remover

Returns a new instance of Remover.



309
310
311
312
# File 'lib/tempfile.rb', line 309

def initialize(path)
  @pid = Process.pid
  @path = path
end

Instance Method Details

#call(*args) ⇒ Object



314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/tempfile.rb', line 314

def call(*args)
  return if @pid != Process.pid

  $stderr.puts "removing #{@path}..." if $DEBUG

  begin
    File.unlink(@path)
  rescue Errno::ENOENT
  end

  $stderr.puts "done" if $DEBUG
end