Module: EnMail::EnMailable
- Included in:
- Mail::Message
- Defined in:
- lib/enmail/enmailable.rb
Instance Method Summary collapse
-
#sign(passphrase: "", key: nil) ⇒ Object
Sign a message.
-
#signable? ⇒ Boolean
Signing status.
-
#signing_key ⇒ EnMail::Key
Signing key.
Instance Method Details
#sign(passphrase: "", key: nil) ⇒ Object
Sign a message
This interface allow us to sign a message while using this gem, this also forecefully sets the ‘signable` status true, so it ensures that the specific message will be signed before sending out.
12 13 14 15 16 17 18 |
# File 'lib/enmail/enmailable.rb', line 12 def sign(passphrase: "", key: nil) @key = key unless passphrase.empty? signing_key.passphrase = passphrase end end |
#signable? ⇒ Boolean
Signing status
This returns the message signing status based on the user specified configuration and signing key. If the user enabled sign_message and provided a valid signing key then this will return true otherwise false, this can be used before trying to sing a message.
39 40 41 |
# File 'lib/enmail/enmailable.rb', line 39 def signable? signing_key.sign_key && EnMail.configuration.signable? end |
#signing_key ⇒ EnMail::Key
Signing key
This returns the signing key when applicable, the default signing key is configured through an initializer, but we are also allowing user to provide a custom key when they are invoking an interface.
28 29 30 |
# File 'lib/enmail/enmailable.rb', line 28 def signing_key @key || EnMail.configuration.defualt_key end |