Method: ActiveRecord::Encryption::Encryptor#encrypted?

Defined in:
lib/active_record/encryption/encryptor.rb

#encrypted?(text) ⇒ Boolean

Returns whether the text is encrypted or not

Returns:

  • (Boolean)


77
78
79
80
81
82
# File 'lib/active_record/encryption/encryptor.rb', line 77

def encrypted?(text)
  deserialize_message(text)
  true
rescue Errors::Encoding, *DECRYPT_ERRORS
  false
end