Class: Chan::Tempfile::Remover
- Inherits:
-
Object
- Object
- Chan::Tempfile::Remover
- Defined in:
- lib/xchan/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.
187 188 189 190 |
# File 'lib/xchan/tempfile.rb', line 187 def initialize(tmpfile) @pid = Process.pid @tmpfile = tmpfile end |
Instance Method Details
#call(*args) ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/xchan/tempfile.rb', line 192 def call(*args) return if @pid != Process.pid warn "removing #{@tmpfile.path}..." if $DEBUG @tmpfile.close begin File.unlink(@tmpfile.path) rescue Errno::ENOENT end warn "done" if $DEBUG end |