better docs for ActiveSupport::EncryptedFile#read

This commit is contained in:
Ryan Zhou 2022-07-12 05:42:16 +00:00
parent e722b74a92
commit d64367e765

@ -49,6 +49,14 @@ def key
read_env_key || read_key_file || handle_missing_key
end
# Reads the file and returns the decrypted content.
#
# Raises:
# - MissingKeyError if the key is missing and +raise_if_missing_key+ is true.
# - MissingContentError if the encrypted file does not exist or otherwise
# if the key is missing.
# - ActiveSupport::MessageEncryptor::InvalidMessage if the content cannot be
# decrypted or verified.
def read
if !key.nil? && content_path.exist?
decrypt content_path.binread