Method: Uffizzi::FileHelper.atomic_write

Defined in:
lib/uffizzi/helpers/file_helper.rb

.atomic_write(path, temp_path, content) ⇒ Object



10
11
12
13
# File 'lib/uffizzi/helpers/file_helper.rb', line 10

def atomic_write(path, temp_path, content)
  File.open(temp_path, 'w') { |f| f.write(content) }
  FileUtils.mv(temp_path, path)
end