Module: ActionText::Encryption
Relationships & Source Files | |
Defined in: | actiontext/lib/action_text/encryption.rb |
Instance Attribute Summary
- #has_encrypted_rich_texts? ⇒ Boolean readonly private
Instance Method Summary
- #decrypt
- #encrypt
- #decrypt_rich_texts private
- #encrypt_rich_texts private
- #encryptable_rich_texts private
Instance Attribute Details
#has_encrypted_rich_texts? ⇒ Boolean
(readonly, private)
[ GitHub ]
# File 'actiontext/lib/action_text/encryption.rb', line 30
def has_encrypted_rich_texts? encryptable_rich_texts.present? end
Instance Method Details
#decrypt
[ GitHub ]# File 'actiontext/lib/action_text/encryption.rb', line 14
def decrypt transaction do super decrypt_rich_texts if has_encrypted_rich_texts? end end
#decrypt_rich_texts (private)
[ GitHub ]# File 'actiontext/lib/action_text/encryption.rb', line 26
def decrypt_rich_texts encryptable_rich_texts.each(&:decrypt) end
#encrypt
[ GitHub ]# File 'actiontext/lib/action_text/encryption.rb', line 7
def encrypt transaction do super encrypt_rich_texts if has_encrypted_rich_texts? end end
#encrypt_rich_texts (private)
[ GitHub ]# File 'actiontext/lib/action_text/encryption.rb', line 22
def encrypt_rich_texts encryptable_rich_texts.each(&:encrypt) end
#encryptable_rich_texts (private)
[ GitHub ]# File 'actiontext/lib/action_text/encryption.rb', line 34
def encryptable_rich_texts @encryptable_rich_texts ||= self.class.rich_text_association_names .filter_map { |attribute_name| send(attribute_name) } .find_all { |record| record.is_a?(ActionText::EncryptedRichText) } end