Module: Siba::TmpDirPlug

Includes:
FilePlug, LoggerPlug
Included in:
Siba, SibaTest
Defined in:
lib/siba/tmp_dir.rb

Instance Method Summary collapse

Methods included from LoggerPlug

close, create, logger, #logger, opened?

Methods included from FilePlug

#siba_file, siba_file, siba_file=

Instance Method Details

#cleanup_tmp_dirObject



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/siba/tmp_dir.rb', line 77

def cleanup_tmp_dir
  unless @tmp_dir_obj.nil?
    logger.debug "Removing temporary files" if Siba::LoggerPlug.opened?
    siba_file.file_utils_cd Siba.current_dir
    @tmp_dir_obj.cleanup
    @tmp_dir_obj = nil
  end
  @tmp_dir = nil unless @tmp_dir.nil?
rescue Exception => ex
  logger.fatal "Failed to remove temporary files" if Siba::LoggerPlug.opened?
  raise
end

#tmp_dirObject



69
70
71
72
73
74
75
# File 'lib/siba/tmp_dir.rb', line 69

def tmp_dir
  if tmp_dir_clean?
    @tmp_dir_obj = TmpDir.new
    @tmp_dir = @tmp_dir_obj.get
  end
  @tmp_dir
end

#tmp_dir_clean?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/siba/tmp_dir.rb', line 90

def tmp_dir_clean?
  @tmp_dir.nil?
end