Class: Flipper::Adapters::DualWrite
- Inherits:
-
Object
- Object
- Flipper::Adapters::DualWrite
show all
- Includes:
- Flipper::Adapter
- Defined in:
- lib/flipper/adapters/dual_write.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#default_config, #export, #import, included, #name, #read_only?
Constructor Details
#initialize(local, remote, options = {}) ⇒ DualWrite
Public: Build a new sync instance.
local - The local flipper adapter that should serve reads. remote - The remote flipper adapter that writes should go to first (in
addition to the local adapter).
13
14
15
16
|
# File 'lib/flipper/adapters/dual_write.rb', line 13
def initialize(local, remote, options = {})
@local = local
@remote = remote
end
|
Instance Attribute Details
#local ⇒ Object
Returns the value of attribute local.
6
7
8
|
# File 'lib/flipper/adapters/dual_write.rb', line 6
def local
@local
end
|
#remote ⇒ Object
Returns the value of attribute remote.
6
7
8
|
# File 'lib/flipper/adapters/dual_write.rb', line 6
def remote
@remote
end
|
Instance Method Details
#add(feature) ⇒ Object
34
35
36
|
# File 'lib/flipper/adapters/dual_write.rb', line 34
def add(feature)
@remote.add(feature).tap { @local.add(feature) }
end
|
#clear(feature) ⇒ Object
42
43
44
|
# File 'lib/flipper/adapters/dual_write.rb', line 42
def clear(feature)
@remote.clear(feature).tap { @local.clear(feature) }
end
|
#disable(feature, gate, thing) ⇒ Object
52
53
54
55
56
|
# File 'lib/flipper/adapters/dual_write.rb', line 52
def disable(feature, gate, thing)
@remote.disable(feature, gate, thing).tap do
@local.disable(feature, gate, thing)
end
end
|
#enable(feature, gate, thing) ⇒ Object
46
47
48
49
50
|
# File 'lib/flipper/adapters/dual_write.rb', line 46
def enable(feature, gate, thing)
@remote.enable(feature, gate, thing).tap do
@local.enable(feature, gate, thing)
end
end
|
#features ⇒ Object
18
19
20
|
# File 'lib/flipper/adapters/dual_write.rb', line 18
def features
@local.features
end
|
#get(feature) ⇒ Object
22
23
24
|
# File 'lib/flipper/adapters/dual_write.rb', line 22
def get(feature)
@local.get(feature)
end
|
#get_all ⇒ Object
30
31
32
|
# File 'lib/flipper/adapters/dual_write.rb', line 30
def get_all
@local.get_all
end
|
#get_multi(features) ⇒ Object
26
27
28
|
# File 'lib/flipper/adapters/dual_write.rb', line 26
def get_multi(features)
@local.get_multi(features)
end
|
#remove(feature) ⇒ Object
38
39
40
|
# File 'lib/flipper/adapters/dual_write.rb', line 38
def remove(feature)
@remote.remove(feature).tap { @local.remove(feature) }
end
|