Class: Thredded::BaseNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/thredded/base_notifier.rb

Defined Under Namespace

Classes: NotificationsDefault

Class Method Summary collapse

Class Method Details

.validate_notifier(notifier) ⇒ Object


5
6
7
8
9
10
11
12
# File 'lib/thredded/base_notifier.rb', line 5

def self.validate_notifier(notifier)
  unless notifier.respond_to?(:key) && /^[a-z_]+$/.match(notifier.key)
    fail "Notifier problem: #{notifier.class.name} must respond to #key with a snake_case string"
  end
  %i[human_name new_post new_private_post].each do |m|
    fail "#{notifier.class.name} must respond to ##{m}" unless notifier.respond_to?(m)
  end
end