Class: Tempfile::Remover
- Inherits:
-
Object
- Object
- Tempfile::Remover
- Defined in:
- lib/tempfile.rb
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.
253 254 255 256 |
# File 'lib/tempfile.rb', line 253 def initialize(tmpfile) @pid = Process.pid @tmpfile = tmpfile end |
Instance Method Details
#call(*args) ⇒ Object
258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/tempfile.rb', line 258 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 |