Class: Tempfile::Remover
- Inherits:
-
Object
- Object
- Tempfile::Remover
- Defined in:
- lib/rubysl/tempfile/tempfile.rb
Overview
:stopdoc:
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(data) ⇒ Remover
constructor
A new instance of Remover.
Constructor Details
#initialize(data) ⇒ Remover
Returns a new instance of Remover.
268 269 270 271 |
# File 'lib/rubysl/tempfile/tempfile.rb', line 268 def initialize(data) @pid = $$ @data = data end |
Instance Method Details
#call(*args) ⇒ Object
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/rubysl/tempfile/tempfile.rb', line 273 def call(*args) if @pid == $$ path, tmpfile = *@data STDERR.print "removing ", path, "..." if $DEBUG tmpfile.close if tmpfile # keep this order for thread safeness if path File.unlink(path) if File.exist?(path) end STDERR.print "done\n" if $DEBUG end end |