Class: Bastet::Base
Instance Method Summary collapse
- #activate(feature, group) ⇒ Object
- #active?(feature, entity) ⇒ Boolean
- #deactivate(feature, group) ⇒ Object
- #inactive?(feature, entity) ⇒ Boolean
Instance Method Details
#activate(feature, group) ⇒ Object
6 7 8 |
# File 'lib/bastet/base.rb', line 6 def activate feature, group act(:sadd, feature, group) end |
#active?(feature, entity) ⇒ Boolean
14 15 16 17 18 |
# File 'lib/bastet/base.rb', line 14 def active? feature, entity group_names = Bastet.redis.smembers(feature_key(feature)) groups = Bastet.groups.select { |group| group_names.include?(group.name) } groups.any? { |group| group.criteria.call(entity) } end |
#deactivate(feature, group) ⇒ Object
10 11 12 |
# File 'lib/bastet/base.rb', line 10 def deactivate feature, group act(:srem, feature, group) end |
#inactive?(feature, entity) ⇒ Boolean
20 21 22 |
# File 'lib/bastet/base.rb', line 20 def inactive? feature, entity !active? feature, entity end |