Class: Flipper::Gates::Group

Inherits:
Flipper::Gate show all
Defined in:
lib/flipper/gates/group.rb

Constant Summary collapse

Key =
:groups

Constants inherited from Flipper::Gate

Flipper::Gate::Separator

Instance Attribute Summary

Attributes inherited from Flipper::Gate

#feature

Instance Method Summary collapse

Methods inherited from Flipper::Gate

#disable, #enable, #initialize, #key, #key_prefix, #match?, #toggle

Constructor Details

This class inherits a constructor from Flipper::Gate

Instance Method Details

#group_namesObject



19
20
21
# File 'lib/flipper/gates/group.rb', line 19

def group_names
  toggle.value
end

#groupsObject



23
24
25
# File 'lib/flipper/gates/group.rb', line 23

def groups
  group_names.map { |name| Flipper.group(name) }.compact
end

#open?(actor) ⇒ Boolean

Returns:



14
15
16
17
# File 'lib/flipper/gates/group.rb', line 14

def open?(actor)
  return if actor.nil?
  groups.any? { |group| group.match?(actor) }
end

#protects?(thing) ⇒ Boolean

Returns:



27
28
29
# File 'lib/flipper/gates/group.rb', line 27

def protects?(thing)
  thing.is_a?(Flipper::Types::Group)
end

#toggle_classObject



10
11
12
# File 'lib/flipper/gates/group.rb', line 10

def toggle_class
  Toggles::Set
end

#type_keyObject



6
7
8
# File 'lib/flipper/gates/group.rb', line 6

def type_key
  Key
end