Class: Flipper::Notifications::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/flipper/notifications/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
10
11
12
# File 'lib/flipper/notifications/configuration.rb', line 7

def initialize
  @enabled   = false
  @notifiers = []
  @webhook_character_limit = nil
  @flipper = nil
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



14
15
16
# File 'lib/flipper/notifications/configuration.rb', line 14

def enabled
  @enabled
end

#flipperObject

The Flipper instance used to READ feature state when rendering a notification. Defaults to the global Flipper.

Notifications are rendered in a background job, which may run in a different process from the one that changed the feature. If your Flipper adapter is fronted by a per-process cache (e.g. an in-memory ActiveSupportCacheStore), the reading process can hold a stale value and the message reports the wrong state. Point this at a cache-free instance backed by your source of truth to always render the real value, e.g.:

config.flipper = Flipper.new(Flipper::Adapters::ActiveRecord.new)


32
33
34
# File 'lib/flipper/notifications/configuration.rb', line 32

def flipper
  @flipper || Flipper
end

#notifiersObject

Returns the value of attribute notifiers.



14
15
16
# File 'lib/flipper/notifications/configuration.rb', line 14

def notifiers
  @notifiers
end

#webhook_character_limitObject

Returns the value of attribute webhook_character_limit.



14
15
16
# File 'lib/flipper/notifications/configuration.rb', line 14

def webhook_character_limit
  @webhook_character_limit
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/flipper/notifications/configuration.rb', line 17

def enabled?
  @enabled
end