Class: Rad::Processors::LetterBuilder
- Inherits:
-
Rad::Processor
- Object
- Rad::Processor
- Rad::Processors::LetterBuilder
- Defined in:
- lib/rad/mail/processors/letter_builder.rb
Instance Attribute Summary
Attributes inherited from Rad::Processor
Instance Method Summary collapse
Methods inherited from Rad::Processor
Constructor Details
This class inherits a constructor from Rad::Processor
Instance Method Details
#call ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rad/mail/processors/letter_builder.rb', line 4 def call # prepare controller = workspace.controller.must_be.present raise "The controller #{controller} must be a Rad::MailController!" unless controller.is_a? Rad::MailController action = workspace.action = workspace.method_name # call content = catch :halt_render do controller.run_callbacks :action, method: action do # call controller controller.send action, *workspace.arguments # render view controller.render action: action end end controller.body = content unless content.blank? # letter workspace.letter = ::Rad::Letter.new( from: controller.from, to: controller.to, subject: controller.subject, body: controller.body ) workspace.letter.validate! next_processor.call if next_processor end |