lib/symmetric_encryption/utils/files.rb in symmetric-encryption-4.3.0 vs lib/symmetric_encryption/utils/files.rb in symmetric-encryption-4.3.1
- old
+ new
@@ -29,10 +29,10 @@
# Write to the supplied file_name, backing up the existing file if present
def write_to_file(file_name, data)
key_path = ::File.dirname(file_name)
::FileUtils.mkdir_p(key_path) unless ::File.directory?(key_path)
::File.rename(file_name, "#{file_name}.#{Time.now.to_i}") if ::File.exist?(file_name)
- ::File.open(file_name, 'wb', 0600) { |file| file.write(data) }
+ ::File.open(file_name, 'wb', 0o600) { |file| file.write(data) }
end
# Read from the file, raising an exception if it is not found
def read_from_file(file_name)
::File.open(file_name, 'rb', &:read)