Class: WorkerScoreboard::Remover

Inherits:
Object
  • Object
show all
Defined in:
lib/worker_scoreboard.rb

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Remover

Returns a new instance of Remover.



97
98
99
100
# File 'lib/worker_scoreboard.rb', line 97

def initialize(data)
  @pid = $$
  @data = data
end

Instance Method Details

#call(*args) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/worker_scoreboard.rb', line 102

def call(*args)
  return if @pid != $$
  path, tmpfile = @data
  STDERR.print "removing ", path, "..." if $DEBUG
  tmpfile.close if tmpfile
  if path
    begin
      File.unlink(path)
    rescue Errno::ENOENT
    end
  end
  STDERR.print "done\n" if $DEBUG
end