Class: UNotifier::Provider::User::ActionMailer
- Inherits:
-
ProviderBase
- Object
- ProviderBase
- UNotifier::Provider::User::ActionMailer
- Defined in:
- lib/provider/user/action_mailer.rb
Instance Method Summary collapse
-
#initialize(mailer, sending_method: :new_notification, notification_conditions: []) ⇒ ActionMailer
constructor
A new instance of ActionMailer.
- #notify(notification) ⇒ Object
- #sensitive? ⇒ Boolean
Methods inherited from ProviderBase
Constructor Details
#initialize(mailer, sending_method: :new_notification, notification_conditions: []) ⇒ ActionMailer
Returns a new instance of ActionMailer.
5 6 7 8 9 |
# File 'lib/provider/user/action_mailer.rb', line 5 def initialize(mailer, sending_method: :new_notification, notification_conditions: []) super(notification_conditions: notification_conditions) @mailer = mailer @sending_method = sending_method end |
Instance Method Details
#notify(notification) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/provider/user/action_mailer.rb', line 11 def notify(notification) return unless can_notify?(notification) sending_method = if @sending_method.is_a?(Array) @sending_method.map { |m| m.call(notification) }&.first else @sending_method end @mailer.public_send(sending_method, notification).deliver end |
#sensitive? ⇒ Boolean
24 25 26 |
# File 'lib/provider/user/action_mailer.rb', line 24 def sensitive? true end |