Module: Mail::Gpg::MessagePatch
- Defined in:
- lib/mail/gpg/message_patch.rb
Class Method Summary collapse
Instance Method Summary collapse
- #decrypt(options = {}) ⇒ Object
- #encrypted? ⇒ Boolean
-
#gpg(options = nil) ⇒ Object
turn on gpg encryption / set gpg options.
Class Method Details
.included(base) ⇒ Object
7 8 9 10 11 |
# File 'lib/mail/gpg/message_patch.rb', line 7 def self.included(base) base.class_eval do attr_accessor :raise_encryption_errors end end |
Instance Method Details
#decrypt(options = {}) ⇒ Object
58 59 60 |
# File 'lib/mail/gpg/message_patch.rb', line 58 def decrypt( = {}) Mail::Gpg.decrypt(self, ) end |
#encrypted? ⇒ Boolean
54 55 56 |
# File 'lib/mail/gpg/message_patch.rb', line 54 def encrypted? Mail::Gpg.encrypted?(self) end |
#gpg(options = nil) ⇒ Object
turn on gpg encryption / set gpg options.
options are:
encrypt: encrypt the message. defaults to true sign: also sign the message. false by default sign_as: UIDs to sign the message with
See Mail::Gpg methods encrypt and sign for more possible options
mail.gpg encrypt: true mail.gpg encrypt: true, sign: true mail.gpg encrypt: true, sign_as: “[email protected]”
future versions will also support sign-only mode: mail.gpg sign_as: ‘[email protected]’, encrypt: false
To turn off gpg encryption use: mail.gpg false
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/mail/gpg/message_patch.rb', line 34 def gpg( = nil) case when nil @gpg when false @gpg = nil if Mail::Gpg::DeliveryHandler == delivery_handler self.delivery_handler = nil end nil end if self.raise_encryption_errors = true if raise_encryption_errors.nil? @gpg = self.delivery_handler ||= Mail::Gpg::DeliveryHandler else @gpg end end |