method

writing

Importance_0
v5.1.7 - Show latest stable - 0 notes - Class: Secrets
writing(contents) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File railties/lib/rails/secrets.rb, line 102
        def writing(contents)
          tmp_file = "#{File.basename(path)}.#{Process.pid}"
          tmp_path = File.join(Dir.tmpdir, tmp_file)
          IO.binwrite(tmp_path, contents)

          yield tmp_path

          updated_contents = IO.binread(tmp_path)

          write(updated_contents) if updated_contents != contents
        ensure
          FileUtils.rm(tmp_path) if File.exist?(tmp_path)
        end
Register or log in to add new notes.