Class: Flipper::Adapters::Sync::FeatureSynchronizer

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/flipper/adapters/sync/feature_synchronizer.rb

Overview

Internal: Given a feature, local gate values and remote gate values, makes the local equal to the remote.

Instance Method Summary collapse

Constructor Details

#initialize(feature, local_gate_values, remote_gate_values) ⇒ FeatureSynchronizer

Returns a new instance of FeatureSynchronizer.



28
29
30
31
32
# File 'lib/flipper/adapters/sync/feature_synchronizer.rb', line 28

def initialize(feature, local_gate_values, remote_gate_values)
  @feature = feature
  @local_gate_values = local_gate_values
  @remote_gate_values = remote_gate_values
end

Instance Method Details

#callObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/flipper/adapters/sync/feature_synchronizer.rb', line 34

def call
  if remote_disabled?
    return if local_disabled?
    @feature.disable
  elsif remote_boolean_enabled?
    return if local_boolean_enabled?
    @feature.enable
  else
    sync_actors
    sync_groups
    sync_percentage_of_actors
    sync_percentage_of_time
  end
end