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.



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

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



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

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