Module: Metasploit::Model::Spec::TemporaryPathname
- Included in:
- Metasploit::Model::Spec
- Defined in:
- lib/metasploit/model/spec/temporary_pathname.rb
Overview
Instance Method Summary collapse
-
#remove_temporary_pathname ⇒ void
Removes #temporary_pathname from disk if it's been set and exists on disk.
-
#temporary_pathname ⇒ Pathname
Pathname to hold temporary files for metasploit-model factories and sequence.
-
#temporary_pathname=(pathname) ⇒ Pathname
Sets the pathname to use for temporary directories and files used in metasploit_data_models factories and sequences.
Instance Method Details
#remove_temporary_pathname ⇒ void
This method returns an undefined value.
Removes #temporary_pathname from disk if it's been set and exists on disk.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/metasploit/model/spec/temporary_pathname.rb', line 25 def remove_temporary_pathname begin removal_pathname = temporary_pathname rescue Metasploit::Model::Spec::Error removal_pathname = nil end if removal_pathname and removal_pathname.exist? removal_pathname.rmtree end end |
#temporary_pathname ⇒ Pathname
Pathname to hold temporary files for metasploit-model factories and sequence. The directory must be be safely writable and removable for specs that need to use the file system.
42 43 44 45 46 47 48 |
# File 'lib/metasploit/model/spec/temporary_pathname.rb', line 42 def temporary_pathname unless instance_variable_defined?(:@temporary_pathname) raise Metasploit::Model::Spec::Error, 'Metasploit::Model::Spec.temporary_pathname not set prior to use' end @temporary_pathname end |
#temporary_pathname=(pathname) ⇒ Pathname
Sets the pathname to use for temporary directories and files used in metasploit_data_models factories and sequences.
56 57 58 |
# File 'lib/metasploit/model/spec/temporary_pathname.rb', line 56 def temporary_pathname=(pathname) @temporary_pathname = pathname end |