Class: Notifier::Base::ActivityWrapper

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/autoload/notifier/base/activity_wrapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(notifier, activity) ⇒ ActivityWrapper

:nodoc:


24
25
26
27
# File 'lib/autoload/notifier/base/activity_wrapper.rb', line 24

def initialize(notifier, activity) #:nodoc:
  super(activity)
  @notifier = notifier
end

Instance Method Details

#notify(recipient, type) ⇒ Object

Send notifications according to input type and recipient


7
8
9
10
11
12
13
# File 'lib/autoload/notifier/base/activity_wrapper.rb', line 7

def notify(recipient, type)
  super(recipient, type).tap do |notification|
    @notifier.send(:notify, recipient, notification)
  end

  self
end

#saveObject

Save activity and send out pending emails


16
17
18
# File 'lib/autoload/notifier/base/activity_wrapper.rb', line 16

def save(*)
  super.tap { |result| send_pending_email if result }
end

#save!Object


20
21
22
# File 'lib/autoload/notifier/base/activity_wrapper.rb', line 20

def save!(*)
  super.tap { |_| send_pending_email }
end