Class: Flipper::Gate
- Inherits:
-
Object
- Object
- Flipper::Gate
- Defined in:
- lib/flipper/gate.rb
Direct Known Subclasses
Flipper::Gates::Actor, Flipper::Gates::Boolean, Flipper::Gates::Expression, Flipper::Gates::Group, Flipper::Gates::PercentageOfActors, Flipper::Gates::PercentageOfTime
Instance Method Summary collapse
- #data_type ⇒ Object
- #enabled?(value) ⇒ Boolean
-
#initialize(options = {}) ⇒ Gate
constructor
Public.
-
#inspect ⇒ Object
Public: Pretty string version for debugging.
-
#key ⇒ Object
Private: Name converted to value safe for adapter.
-
#name ⇒ Object
Public: The name of the gate.
-
#open?(actors, value, options = {}) ⇒ Boolean
Internal: Check if a gate is open for one or more actors.
-
#protects?(actor) ⇒ Boolean
Internal: Check if a gate is protects an actor.
-
#wrap(actor) ⇒ Object
Internal: Allows gate to wrap actor using one of the supported flipper types so adapters always get someactor that responds to value.
Constructor Details
#initialize(options = {}) ⇒ Gate
Public
4 5 |
# File 'lib/flipper/gate.rb', line 4 def initialize( = {}) end |
Instance Method Details
#data_type ⇒ Object
17 18 19 |
# File 'lib/flipper/gate.rb', line 17 def data_type raise 'Not implemented' end |
#enabled?(value) ⇒ Boolean
21 22 23 |
# File 'lib/flipper/gate.rb', line 21 def enabled?(value) raise 'Not implemented' end |
#inspect ⇒ Object
Public: Pretty string version for debugging.
47 48 49 50 51 52 53 54 |
# File 'lib/flipper/gate.rb', line 47 def inspect attributes = [ "name=#{name.inspect}", "key=#{key.inspect}", "data_type=#{data_type.inspect}", ] "#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>" end |
#key ⇒ Object
Private: Name converted to value safe for adapter. Implemented in subclass.
13 14 15 |
# File 'lib/flipper/gate.rb', line 13 def key raise 'Not implemented' end |
#name ⇒ Object
Public: The name of the gate. Implemented in subclass.
8 9 10 |
# File 'lib/flipper/gate.rb', line 8 def name raise 'Not implemented' end |
#open?(actors, value, options = {}) ⇒ Boolean
Internal: Check if a gate is open for one or more actors. Implemented in subclass.
Returns true if gate open for any actor, false if not.
29 30 31 |
# File 'lib/flipper/gate.rb', line 29 def open?(actors, value, = {}) false end |
#protects?(actor) ⇒ Boolean
Internal: Check if a gate is protects an actor. Implemented in subclass.
Returns true if gate protects actor, false if not.
36 37 38 |
# File 'lib/flipper/gate.rb', line 36 def protects?(actor) false end |
#wrap(actor) ⇒ Object
Internal: Allows gate to wrap actor using one of the supported flipper types so adapters always get someactor that responds to value.
42 43 44 |
# File 'lib/flipper/gate.rb', line 42 def wrap(actor) actor end |