@param [String] prefix A string prefix that indicates which temporary
filenames should be deleted.
@return [void]
# File lib/nanoc/base/temp_filename_factory.rb, line 41 def cleanup(prefix) path = File.join(@root_dir, prefix) if File.exist?(path) FileUtils.remove_entry_secure(path) end @counts.delete(prefix) end
@param [String] prefix A string prefix to include in the temporary
filename, often the type of filename being provided.
@return [String] A new unused filename
# File lib/nanoc/base/temp_filename_factory.rb, line 25 def create(prefix) count = @counts.fetch(prefix, 0) @counts[prefix] = count + 1 dirname = File.join(@root_dir, prefix) filename = File.join(@root_dir, prefix, count.to_s) FileUtils.mkdir_p(dirname) filename end
Generated with the Darkfish Rdoc Generator 2.