Class: Bio::Command::Tmpdir::Remover

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/command.rb

Overview

Internal use only. Users should not use this class directly.

Bio::Command::Tmpdir::Remover is a class to remove temporary directory.

Acknowledgement: The essense of the code is taken from tempfile.rb in Ruby trunk (svn 34413) and in Ruby 1.8.7.

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Remover

Internal use only. Users should not call this method.



637
638
639
640
# File 'lib/bio/command.rb', line 637

def initialize(data)
  @pid = $$
  @data = data
end

Instance Method Details

#call(*args) ⇒ Object

Internal use only. Users should not call this method.



643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
# File 'lib/bio/command.rb', line 643

def call(*args)
  return if @pid != $$

  path, = *@data

  STDERR.print "removing ", path, "..." if $DEBUG
  if path and !path.empty? and
      File.directory?(path) and
      !File.symlink?(path) then
    Bio::Command.remove_entry_secure(path)
    $stderr.print "done\n" if $DEBUG
  else
    $stderr.print "skipped\n" if $DEBUG
  end
end