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
.
251 252 253 254 |
# File 'lib/roda/plugins/mailer.rb', line 251 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.
239 240 241 242 243 244 245 246 |
# File 'lib/roda/plugins/mailer.rb', line 239 def initialize(env) super if mail = env['roda.mail'] res = @_response res.mail = mail res.headers.delete(RodaResponseHeaders::CONTENT_TYPE) end end |
#no_mail! ⇒ Object
Signal that no mail should be sent for this request.
257 258 259 |
# File 'lib/roda/plugins/mailer.rb', line 257 def no_mail! throw :no_mail end |