Class: Togls::Rules::Group
- Inherits:
-
Togls::Rule
- Object
- Togls::Rule
- Togls::Rules::Group
- Defined in:
- lib/togls/rules/group.rb
Overview
Group Rule
The Group Rule is a provided Rule that expects to be given an Array as it’s initialization data and when evaluated determines the toggle state based on the given target being included in the Array that was passed in during initialization. This allows you to define various groups. For example:
alpha_testers = Togls::Rules::Group.new([‘[email protected]’, ‘[email protected]’]) Togls.features do
feature(:foo).on(alpha_testers)
end
if Togls.feature(:foo).on?(current_user.email)
...
end
Instance Attribute Summary
Attributes inherited from Togls::Rule
Instance Method Summary collapse
Methods inherited from Togls::Rule
Constructor Details
This class inherits a constructor from Togls::Rule
Instance Method Details
#run(_key, target) ⇒ Object
20 21 22 |
# File 'lib/togls/rules/group.rb', line 20 def run(_key, target) @data.include?(target) end |