Class | Bio::Command::Tmpdir |
In: |
lib/bio/command.rb
|
Parent: | Object |
Bio::Command::Tmpdir is a wrapper class to handle temporary directory like Tempfile class. A temporary directory is created when the object of the class is created, and automatically removed when the object is destroyed by GC.
BioRuby library internal use only.
Creates a new Tmpdir object. The arguments are the same as Bio::Command.mktmpdir.
Arguments:
Returns: | Tmpdir object |
# File lib/bio/command.rb, line 668 668: def initialize(prefix_suffix = nil, tmpdir = nil) 669: @data = [] 670: @clean_proc = Remover.new(@data) 671: ObjectSpace.define_finalizer(self, @clean_proc) 672: @data.push(@path = Bio::Command.mktmpdir(prefix_suffix, tmpdir).freeze) 673: end
Removes the temporary directory.
Returns: | nil |
# File lib/bio/command.rb, line 685 685: def close! 686: # raise error if path is nil 687: self.path 688: # finilizer object is called to remove the directory 689: @clean_proc.call 690: # unregister finalizer 691: ObjectSpace.undefine_finalizer(self) 692: # @data and @path is removed 693: @data = @path = nil 694: end