Class: FeatureFlagger::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/feature_flagger/notifier.rb

Constant Summary collapse

RELEASE =
'release'.freeze
UNRELEASE =
'unrelease'.freeze
RELEASE_TO_ALL =
'release_to_all'.freeze
UNRELEASE_TO_ALL =
'unrelease_to_all'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notify = nil) ⇒ Notifier

Returns a new instance of Notifier.



10
11
12
# File 'lib/feature_flagger/notifier.rb', line 10

def initialize(notify = nil)
  @notify = valid_notify?(notify) ? notify : nullNotify
end

Instance Attribute Details

#notifyObject (readonly)

Returns the value of attribute notify.



3
4
5
# File 'lib/feature_flagger/notifier.rb', line 3

def notify
  @notify
end

Instance Method Details

#send(operation, feature_key, resource_id = nil) ⇒ Object



14
15
16
# File 'lib/feature_flagger/notifier.rb', line 14

def send(operation, feature_key, resource_id = nil)
  @notify.call(build_event(operation, extract_resource_from_key(feature_key), feature_key, resource_id))
end