Method: TempDir.create

Defined in:
lib/temp_dir.rb

.create(attrs = {}, &block) ⇒ Object

Usage

TempDir can be called with or without a block.

With Block

TempDir.create( [:basename => value] [, :rootpath => value] [, :name => value]) do |tmpdir|
    # Directory is automatically changed to tmpdir
    code here
end

Examples

TempDir.create { |dir|  # do work here }   # Directory is auto deleted
TempDir.create(:rootpath => "/mytmp" ) { |dir| ... }
TempDir.create(:rootpath => "./", :name => "mytempfolder") { |dir| ... }
TempDir.create(:basename => "picfiles") { |dir| ... }

Without Block

tempdir = TempDir.create
# User is responsible for removing tempdir


23
24
25
# File 'lib/temp_dir.rb', line 23

def self.create(attrs = {}, &block)
  new(DFLT_CREATE_ATTRS.merge(attrs)).send(:create, &block)
end