Skip to content

Commit

Permalink
better docs for ActiveSupport::EncryptedFile#read
Browse files Browse the repository at this point in the history
  • Loading branch information
whyinzoo committed Jul 16, 2022
1 parent e722b74 commit d64367e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions activesupport/lib/active_support/encrypted_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d64367e

Please sign in to comment.