Class: Flipper::Gate
- Inherits:
-
Object
show all
- Extended by:
- Forwardable
- Defined in:
- lib/flipper/gate.rb
Constant Summary
collapse
- Separator =
'/'
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(feature) ⇒ Gate
Returns a new instance of Gate.
13
14
15
|
# File 'lib/flipper/gate.rb', line 13
def initialize(feature)
@feature = feature
end
|
Instance Attribute Details
#feature ⇒ Object
Returns the value of attribute feature.
9
10
11
|
# File 'lib/flipper/gate.rb', line 9
def feature
@feature
end
|
Instance Method Details
#disable(thing) ⇒ Object
45
46
47
|
# File 'lib/flipper/gate.rb', line 45
def disable(thing)
toggle.disable(thing)
end
|
#enable(thing) ⇒ Object
41
42
43
|
# File 'lib/flipper/gate.rb', line 41
def enable(thing)
toggle.enable(thing)
end
|
#key ⇒ Object
21
22
23
|
# File 'lib/flipper/gate.rb', line 21
def key
"#{key_prefix}#{Separator}#{type_key}"
end
|
#key_prefix ⇒ Object
17
18
19
|
# File 'lib/flipper/gate.rb', line 17
def key_prefix
@feature.name
end
|
#match?(actor) ⇒ Boolean
37
38
39
|
# File 'lib/flipper/gate.rb', line 37
def match?(actor)
false
end
|
#protects?(thing) ⇒ Boolean
33
34
35
|
# File 'lib/flipper/gate.rb', line 33
def protects?(thing)
false
end
|
#toggle ⇒ Object
29
30
31
|
# File 'lib/flipper/gate.rb', line 29
def toggle
@toggle ||= toggle_class.new(self)
end
|
#toggle_class ⇒ Object
25
26
27
|
# File 'lib/flipper/gate.rb', line 25
def toggle_class
Toggles::Value
end
|