Module: Roda::RodaPlugins::Mailer::InstanceMethods
- Defined in:
- lib/roda/plugins/mailer.rb
Instance Method Summary collapse
-
#add_file(*a, &block) ⇒ Object
Delay adding a file to the message until after the message body has been set.
-
#initialize(env) ⇒ Object
If this is an email request, set the mail object in the response, as well as the default content_type for the email.
-
#no_mail! ⇒ Object
Signal that no mail should be sent for this request.
Instance Method Details
#add_file(*a, &block) ⇒ Object
Delay adding a file to the message until after the message body has been set. If a block is given, the block is called after the file has been added, and you can access the attachment via response.mail_attachments.last
.
245 246 247 248 |
# File 'lib/roda/plugins/mailer.rb', line 245 def add_file(*a, &block) response. << [a, block] nil end |
#initialize(env) ⇒ Object
If this is an email request, set the mail object in the response, as well as the default content_type for the email.
233 234 235 236 237 238 239 240 |
# File 'lib/roda/plugins/mailer.rb', line 233 def initialize(env) super if mail = env['roda.mail'] res = @_response res.mail = mail res.headers.delete('Content-Type') end end |
#no_mail! ⇒ Object
Signal that no mail should be sent for this request.
251 252 253 |
# File 'lib/roda/plugins/mailer.rb', line 251 def no_mail! throw :no_mail end |