Sha256: c57df6a951ffa0e804cedd6da88ee95d4040a2307b0ee42812ba37ec0a45e5da
Contents?: true
Size: 1.02 KB
Versions: 3
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? { |name| begin group = Flipper.group(name) group.match?(context.thing, context) rescue GroupNotRegistered false 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
flipper-0.10.2 | lib/flipper/gates/group.rb |
flipper-0.10.1 | lib/flipper/gates/group.rb |
flipper-0.10.0 | lib/flipper/gates/group.rb |