Class: UNotifier::Provider::ProviderBase

Inherits:
Object
  • Object
show all
Defined in:
lib/provider/provider_base.rb

Instance Method Summary collapse

Constructor Details

#initialize(notification_conditions: []) ⇒ ProviderBase

Returns a new instance of ProviderBase.



4
5
6
# File 'lib/provider/provider_base.rb', line 4

def initialize(notification_conditions: [])
  @notification_conditions = notification_conditions
end

Instance Method Details

#can_notify?(notification) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/provider/provider_base.rb', line 8

def can_notify?(notification)
  return true if @notification_conditions.empty?

  @notification_conditions.all? { |c| c.call(notification) }
end