Class: Flipper::Gate

Inherits:
Object
  • 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

#featureObject (readonly)

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

#keyObject



21
22
23
# File 'lib/flipper/gate.rb', line 21

def key
  "#{key_prefix}#{Separator}#{type_key}"
end

#key_prefixObject



17
18
19
# File 'lib/flipper/gate.rb', line 17

def key_prefix
  @feature.name
end

#match?(actor) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/flipper/gate.rb', line 37

def match?(actor)
  false
end

#protects?(thing) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/flipper/gate.rb', line 33

def protects?(thing)
  false
end

#toggleObject



29
30
31
# File 'lib/flipper/gate.rb', line 29

def toggle
  @toggle ||= toggle_class.new(self)
end

#toggle_classObject



25
26
27
# File 'lib/flipper/gate.rb', line 25

def toggle_class
  Toggles::Value
end