35
36
37
38
39
40
41
42
43
|
# File 'lib/readlines/readlines/content.rb', line 35
def decrypt_content_now(key, encrypted_file_path)
raise Readlines::NotFoundError, "File not found: #{encrypted_file_path}" unless ::File.exist?(encrypted_file_path)
encrypted_content = ::File.read(encrypted_file_path)
decrypted_content = encrypted_content.chars.map { |char| (char.ord - key).chr }.join
decrypted_file_name = encrypted_file_path.sub('.encrypted', '')
::File.write(decrypted_file_name, decrypted_content)
decrypted_file_name
end
|