Sha256: b08d5cdeaf863a7710c4439e05fbab63afcdfea8c3f03566f11701fc620959ca
Contents?: true
Size: 554 Bytes
Versions: 2
Compression:
Stored size: 554 Bytes
Contents
require 'singleton' class Bastet::Base include Singleton def activate feature, group Bastet.redis.sadd("feature_#{feature}", group.name) end def deactivate feature, group Bastet.redis.srem("feature_#{feature}", group.name) end def active? feature, entity group_names = Bastet.redis.smembers("feature_#{feature}") groups = Bastet.groups.select { |group| group_names.include?(group.name) } groups.any? { |group| group.criteria.call(entity) } end def inactive? feature, entity !active? feature, entity end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bastet-0.1.1 | lib/bastet/base.rb |
bastet-0.1.0 | lib/bastet/base.rb |