Class: Chan::Tempfile::Remover
Overview
:nodoc:
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(tmpfile) ⇒ Remover
constructor
A new instance of Remover.
Constructor Details
#initialize(tmpfile) ⇒ Remover
Returns a new instance of Remover.
189 190 191 192 |
# File 'lib/xchan/tempfile.rb', line 189 def initialize(tmpfile) @pid = Process.pid @tmpfile = tmpfile end |
Instance Method Details
#call(*args) ⇒ Object
194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/xchan/tempfile.rb', line 194 def call(*args) return if @pid != Process.pid $stderr.puts "removing #{@tmpfile.path}..." if $DEBUG @tmpfile.close begin File.unlink(@tmpfile.path) rescue Errno::ENOENT end $stderr.puts "done" if $DEBUG end |