Sha256: 99ccfb646cdb437f10285fd0d619f81869eddfdcf7107a52d0f1dc56008cd5d3
Contents?: true
Size: 1.02 KB
Versions: 5
Compression:
Stored size: 1.02 KB
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) value = context.values[key] if context.thing.nil? false else value.any? do |name| begin group = Flipper.group(name) group.match?(context.thing, context) rescue GroupNotRegistered false end end 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
5 entries across 5 versions & 1 rubygems