Class: Flipper::Gates::Boolean

Inherits:
Flipper::Gate show all
Defined in:
lib/flipper/gates/boolean.rb

Constant Summary collapse

Key =
:boolean

Constants inherited from Flipper::Gate

Flipper::Gate::Separator

Instance Attribute Summary

Attributes inherited from Flipper::Gate

#feature

Instance Method Summary collapse

Methods inherited from Flipper::Gate

#disable, #enable, #initialize, #key, #key_prefix, #match?, #toggle

Constructor Details

This class inherits a constructor from Flipper::Gate

Instance Method Details

#open?(actor) ⇒ Boolean

Returns:



14
15
16
17
18
19
20
21
22
# File 'lib/flipper/gates/boolean.rb', line 14

def open?(actor)
  value = toggle.value

  if value.nil?
    false
  else
    throw :short_circuit, !!value
  end
end

#protects?(thing) ⇒ Boolean

Returns:



24
25
26
# File 'lib/flipper/gates/boolean.rb', line 24

def protects?(thing)
  thing.is_a?(Flipper::Types::Boolean)
end

#toggle_classObject



10
11
12
# File 'lib/flipper/gates/boolean.rb', line 10

def toggle_class
  Toggles::Boolean
end

#type_keyObject



6
7
8
# File 'lib/flipper/gates/boolean.rb', line 6

def type_key
  Key
end