Class: Tempfile::Remover
- Inherits:
-
Object
- Object
- Tempfile::Remover
- Defined in:
- lib/rubysl/tempfile/tempfile.rb
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.
270 271 272 273 |
# File 'lib/rubysl/tempfile/tempfile.rb', line 270 def initialize(data) @pid = $$ @data = data end |
Instance Method Details
#call(*args) ⇒ Object
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/rubysl/tempfile/tempfile.rb', line 275 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 |