Class: Flipper::Adapters::ReadOnly

Inherits:
Object
  • Object
show all
Includes:
Flipper::Adapter
Defined in:
lib/flipper/adapters/read_only.rb

Overview

Public: Adapter that wraps another adapter and raises for any writes.

Defined Under Namespace

Classes: WriteAttempted

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter) ⇒ ReadOnly

Public



17
18
19
20
# File 'lib/flipper/adapters/read_only.rb', line 17

def initialize(adapter)
  @adapter = adapter
  @name = :read_only
end

Instance Attribute Details

#nameObject (readonly)

Internal: The name of the adapter.



14
15
16
# File 'lib/flipper/adapters/read_only.rb', line 14

def name
  @name
end

Instance Method Details

#add(feature) ⇒ Object

Raises:



30
31
32
# File 'lib/flipper/adapters/read_only.rb', line 30

def add(feature)
  raise WriteAttempted
end

#clear(feature) ⇒ Object

Raises:



38
39
40
# File 'lib/flipper/adapters/read_only.rb', line 38

def clear(feature)
  raise WriteAttempted
end

#disable(feature, gate, thing) ⇒ Object

Raises:



46
47
48
# File 'lib/flipper/adapters/read_only.rb', line 46

def disable(feature, gate, thing)
  raise WriteAttempted
end

#enable(feature, gate, thing) ⇒ Object

Raises:



42
43
44
# File 'lib/flipper/adapters/read_only.rb', line 42

def enable(feature, gate, thing)
  raise WriteAttempted
end

#featuresObject



22
23
24
# File 'lib/flipper/adapters/read_only.rb', line 22

def features
  @adapter.features
end

#get(feature) ⇒ Object



26
27
28
# File 'lib/flipper/adapters/read_only.rb', line 26

def get(feature)
  @adapter.get(feature)
end

#remove(feature) ⇒ Object

Raises:



34
35
36
# File 'lib/flipper/adapters/read_only.rb', line 34

def remove(feature)
  raise WriteAttempted
end