class Flipper::Gates::Group

Public Instance Methods

data_type() click to toggle source
# File lib/flipper/gates/group.rb, line 14
def data_type
  :set
end
enabled?(value) click to toggle source
# File lib/flipper/gates/group.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/group.rb, line 10
def key
  :groups
end
name() click to toggle source

Internal: The name of the gate. Used for instrumentation, etc.

# File lib/flipper/gates/group.rb, line 5
def name
  :group
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/group.rb, line 25
def open?(context)
  value = context.values[key]
  if context.thing.nil?
    false
  else
    value.any? do |name|
      group = Flipper.group(name)
      group.match?(context.thing, context)
    end
  end
end
protects?(thing) click to toggle source
# File lib/flipper/gates/group.rb, line 41
def protects?(thing)
  thing.is_a?(Types::Group) || thing.is_a?(Symbol)
end
wrap(thing) click to toggle source
# File lib/flipper/gates/group.rb, line 37
def wrap(thing)
  Types::Group.wrap(thing)
end