Sha256: 9d7d4debdf4568ae01df92472a6bad423873617ed8ace0869648ff3aee19b24a
Contents?: true
Size: 870 Bytes
Versions: 4
Compression:
Stored size: 870 Bytes
Contents
module Flipper module Gates class Group < Gate # Internal: The name of the gate. Used for instrumentation, etc. def name :group end # Internal: Name converted to value safe for adapter. def key :groups end def data_type :set end def enabled?(value) !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?(context) return false if context.thing.nil? context.values.groups.any? do |name| Flipper.group(name).match?(context.thing, context) end end def wrap(thing) Types::Group.wrap(thing) end def protects?(thing) thing.is_a?(Types::Group) || thing.is_a?(Symbol) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
flipper-0.27.1 | lib/flipper/gates/group.rb |
flipper-0.27.0 | lib/flipper/gates/group.rb |
flipper-0.26.2 | lib/flipper/gates/group.rb |
flipper-0.26.1 | lib/flipper/gates/group.rb |