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.



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

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

Instance Method Details

#call(*args) ⇒ Object

Internal use only. Users should not call this method.



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

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