class Flipper::Gates::Actor
Public Instance Methods
data_type()
click to toggle source
# File lib/flipper/gates/actor.rb, line 14 def data_type :set end
enabled?(value)
click to toggle source
# File lib/flipper/gates/actor.rb, line 18 def enabled?(value) !value.empty? end
key()
click to toggle source
Internal: Name converted to value safe for adapter.
# File lib/flipper/gates/actor.rb, line 10 def key :actors end
name()
click to toggle source
Internal: The name of the gate. Used for instrumentation, etc.
# File lib/flipper/gates/actor.rb, line 5 def name :actor end
open?(context)
click to toggle source
Internal: Checks if the gate is open for a thing.
Returns true if gate open for thing, false if not.
# File lib/flipper/gates/actor.rb, line 25 def open?(context) value = context.values[key] if context.thing.nil? false else if protects?(context.thing) actor = wrap(context.thing) enabled_actor_ids = value enabled_actor_ids.include?(actor.value) else false end end end
protects?(thing)
click to toggle source
# File lib/flipper/gates/actor.rb, line 44 def protects?(thing) Types::Actor.wrappable?(thing) end
wrap(thing)
click to toggle source
# File lib/flipper/gates/actor.rb, line 40 def wrap(thing) Types::Actor.wrap(thing) end