Class: Shark::MailingService::Mailer
- Inherits:
-
Object
- Object
- Shark::MailingService::Mailer
- Defined in:
- lib/shark/mailing_service/mailer.rb
Class Attribute Summary collapse
Instance Attribute Summary collapse
-
#layout ⇒ Object
readonly
Returns the value of attribute layout.
-
#template_name ⇒ Object
readonly
Returns the value of attribute template_name.
-
#template_path ⇒ Object
readonly
Returns the value of attribute template_path.
Class Method Summary collapse
Instance Method Summary collapse
- #deliver ⇒ Object (also: #deliver_now)
-
#initialize(layout:, template_path:, template_name:) ⇒ Mailer
constructor
A new instance of Mailer.
Constructor Details
#initialize(layout:, template_path:, template_name:) ⇒ Mailer
Returns a new instance of Mailer.
43 44 45 46 47 |
# File 'lib/shark/mailing_service/mailer.rb', line 43 def initialize(layout:, template_path:, template_name:) @layout = layout @template_name = template_name @template_path = template_path end |
Class Attribute Details
.layout ⇒ Object
9 10 11 |
# File 'lib/shark/mailing_service/mailer.rb', line 9 def layout @layout || MailingService.config.default_layout end |
.template_root ⇒ Object
25 26 27 |
# File 'lib/shark/mailing_service/mailer.rb', line 25 def template_root @template_root || MailingService.config.default_template_root end |
Instance Attribute Details
#layout ⇒ Object (readonly)
Returns the value of attribute layout.
41 42 43 |
# File 'lib/shark/mailing_service/mailer.rb', line 41 def layout @layout end |
#template_name ⇒ Object (readonly)
Returns the value of attribute template_name.
41 42 43 |
# File 'lib/shark/mailing_service/mailer.rb', line 41 def template_name @template_name end |
#template_path ⇒ Object (readonly)
Returns the value of attribute template_path.
41 42 43 |
# File 'lib/shark/mailing_service/mailer.rb', line 41 def template_path @template_path end |
Class Method Details
.method_missing(method, *args, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/shark/mailing_service/mailer.rb', line 13 def method_missing(method, *args, &block) return super unless respond_to?(method) instance = new( layout: layout, template_name: method.to_s, template_path: File.join(template_root.to_s, name.underscore) ) instance.send(method, *args) instance end |
Instance Method Details
#deliver ⇒ Object Also known as: deliver_now
49 50 51 |
# File 'lib/shark/mailing_service/mailer.rb', line 49 def deliver @mail.save end |