Class: Flipper::Gates::Actor
- Inherits:
-
Flipper::Gate
- Object
- Flipper::Gate
- Flipper::Gates::Actor
- Defined in:
- lib/flipper/gates/actor.rb
Instance Method Summary collapse
- #data_type ⇒ Object
- #enabled?(value) ⇒ Boolean
-
#key ⇒ Object
Internal: Name converted to value safe for adapter.
-
#name ⇒ Object
Internal: The name of the gate.
-
#open?(context) ⇒ Boolean
Internal: Checks if the gate is open for an actor.
- #protects?(actor) ⇒ Boolean
- #wrap(actor) ⇒ Object
Methods inherited from Flipper::Gate
Constructor Details
This class inherits a constructor from Flipper::Gate
Instance Method Details
#data_type ⇒ Object
14 15 16 |
# File 'lib/flipper/gates/actor.rb', line 14 def data_type :set end |
#enabled?(value) ⇒ Boolean
18 19 20 |
# File 'lib/flipper/gates/actor.rb', line 18 def enabled?(value) !value.empty? end |
#key ⇒ Object
Internal: Name converted to value safe for adapter.
10 11 12 |
# File 'lib/flipper/gates/actor.rb', line 10 def key :actors end |
#name ⇒ Object
Internal: The name of the gate. Used for instrumentation, etc.
5 6 7 |
# File 'lib/flipper/gates/actor.rb', line 5 def name :actor end |
#open?(context) ⇒ Boolean
Internal: Checks if the gate is open for an actor.
Returns true if gate open for actor, false if not.
25 26 27 28 29 30 31 |
# File 'lib/flipper/gates/actor.rb', line 25 def open?(context) return false unless context.actors? context.actors.any? do |actor| context.values.actors.include?(actor.value) end end |
#protects?(actor) ⇒ Boolean
37 38 39 |
# File 'lib/flipper/gates/actor.rb', line 37 def protects?(actor) Types::Actor.wrappable?(actor) end |