class ActsAsNotifier::NotificationDsl

Attributes

notification_actions[RW]

Public Class Methods

evaluate(&script) click to toggle source
# File lib/acts_as_notifier.rb, line 152
def evaluate(&script)
  self.new.tap {|inst| inst.instance_eval(&script)}.notification_actions
end
new() click to toggle source
# File lib/acts_as_notifier.rb, line 157
def initialize
  @current_callback_type = nil
  @notification_actions = []
end

Public Instance Methods

after_create(&block) click to toggle source
# File lib/acts_as_notifier.rb, line 162
def after_create(&block)
  @current_callback_type = :after_create
  instance_eval(&block)
end
after_save(&block) click to toggle source
# File lib/acts_as_notifier.rb, line 167
def after_save(&block)
  @current_callback_type = :after_save
  instance_eval(&block)
end
after_update(&block) click to toggle source
# File lib/acts_as_notifier.rb, line 172
def after_update(&block)
  @current_callback_type = :after_update
  instance_eval(&block)
end
notify(recipients, options = {}) click to toggle source
# File lib/acts_as_notifier.rb, line 177
def notify(recipients, options = {})
  action = { recipients: recipients, callback_type: @current_callback_type }.merge(options || {})
  @notification_actions << action
end