Class: Outbox::Notifier
- Inherits:
-
ActionMailer::Base
- Object
- ActionMailer::Base
- Outbox::Notifier
- Extended by:
- DefineInheritableMethod
- Includes:
- NotifierTypes
- Defined in:
- lib/outbox/notifier.rb
Class Method Summary collapse
-
.notifier_name(value = nil) ⇒ Object
(also: notifier_name=)
Returns the name of current notifier.
Instance Method Summary collapse
- #attachments ⇒ Object
-
#headers(args = nil) ⇒ Object
:nodoc:.
-
#initialize(method_name = nil, *args) ⇒ Notifier
constructor
:nodoc:.
-
#message ⇒ Object
The composed Outbox::Message instance.
-
#message_rendered? ⇒ Boolean
Returns true if the message has already been rendered.
-
#process(*args) ⇒ Object
:nodoc:.
-
#render_message(options = {}, &block) ⇒ Object
Renders the message body.
Constructor Details
#initialize(method_name = nil, *args) ⇒ Notifier
:nodoc:
40 41 42 43 44 45 |
# File 'lib/outbox/notifier.rb', line 40 def initialize(method_name = nil, *args) # :nodoc: super() @_message_rendered = false @_message = process(method_name, *args) if method_name end |
Class Method Details
.notifier_name(value = nil) ⇒ Object Also known as: notifier_name=
Returns the name of current notifier. This method is also being used as a path for a view lookup. If this is an anonymous notifier, this method will return anonymous
instead.
19 20 21 22 23 24 25 |
# File 'lib/outbox/notifier.rb', line 19 def notifier_name(value = nil) if value.nil? mailer_name else self.mailer_name = value end end |
Instance Method Details
#attachments ⇒ Object
86 87 88 89 90 |
# File 'lib/outbox/notifier.rb', line 86 def # Make sure the email message instance exists email({}) if email.nil? email. end |
#headers(args = nil) ⇒ Object
:nodoc:
76 77 78 79 80 81 82 83 84 |
# File 'lib/outbox/notifier.rb', line 76 def headers(args = nil) # :nodoc: # Make sure the email message instance exists email({}) if email.nil? if args email.headers(args) else email end end |
#message ⇒ Object
The composed Outbox::Message instance.
55 56 57 58 |
# File 'lib/outbox/notifier.rb', line 55 def unless @_message end |
#message_rendered? ⇒ Boolean
Returns true if the message has already been rendered.
61 62 63 |
# File 'lib/outbox/notifier.rb', line 61 def @_message_rendered end |
#process(*args) ⇒ Object
:nodoc:
47 48 49 50 51 52 |
# File 'lib/outbox/notifier.rb', line 47 def process(*args) # :nodoc: = @_message super # Make sure we don't ever get a NullMail object. @_message = end |
#render_message(options = {}, &block) ⇒ Object
Renders the message body. This is analagous to ActionMailer’s #mail method, but is not required - it will be called implicitly when the #message object is retrieved.
68 69 70 71 72 73 74 |
# File 'lib/outbox/notifier.rb', line 68 def ( = {}, &block) @_message_rendered = true render_email(@_message.email, , &block) if @_message.email () @_message.() @_message end |