Sha256: 1df34a3fbdca1e3fc139b2df14b8fc9fd0bb0b5376376e890a4dcdff1a20b62f
Contents?: true
Size: 988 Bytes
Versions: 10
Compression:
Stored size: 988 Bytes
Contents
module Flipper module Gates class Actor < Gate # Internal: The name of the gate. Used for instrumentation, etc. def name :actor end # Internal: Name converted to value safe for adapter. def key :actors end def data_type :set end def enabled?(value) !Typecast.to_set(value).empty? end # Internal: Checks if the gate is open for a thing. # # Returns true if gate open for thing, false if not. def open?(thing, value, options = {}) if thing.nil? false else if protects?(thing) actor = wrap(thing) enabled_actor_ids = value enabled_actor_ids.include?(actor.value) else false end end end def wrap(thing) Types::Actor.wrap(thing) end def protects?(thing) Types::Actor.wrappable?(thing) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems