Class: Tempfile::Remover
- Inherits:
-
Object
- Object
- Tempfile::Remover
- Defined in:
- lib/tempfile.rb
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.
245 246 247 248 |
# File 'lib/tempfile.rb', line 245 def initialize(tmpfile) @pid = Process.pid @tmpfile = tmpfile end |
Instance Method Details
#call(*args) ⇒ Object
250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/tempfile.rb', line 250 def call(*args) return if @pid != Process.pid warn "removing #{@tmpfile.path}..." if $DEBUG @tmpfile.close unless @tmpfile.closed? begin File.unlink(@tmpfile.path) rescue Errno::ENOENT end warn "done" if $DEBUG end |