Sha256: 8c47955e93000d65b51c0c64a88fedf491bd0968bd054f52da52bbc43d51fcce
Contents?: true
Size: 689 Bytes
Versions: 1
Compression:
Stored size: 689 Bytes
Contents
require 'singleton' class Bastet::Base include Singleton def activate feature, group act(:sadd, feature, group) end def deactivate feature, group act(:srem, feature, group) end 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 def inactive? feature, entity !active? feature, entity end private def act method, feature, group Bastet.redis.send(method, feature_key(feature), group.name) end def feature_key feature "feature_#{feature}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bastet-0.1.2 | lib/bastet/base.rb |