Sha256: 0753156181d16508cad07629bdf42675831e61dbd2f93661c7c31866379982dc
Contents?: true
Size: 751 Bytes
Versions: 22
Compression:
Stored size: 751 Bytes
Contents
require 'bundler/setup' require 'flipper' # Some class that represents what will be trying to do something class User attr_reader :id def initialize(id, admin) @id = id @admin = admin end def admin? @admin end # Must respond to flipper_id alias_method :flipper_id, :id end user1 = User.new(1, true) user2 = User.new(2, false) Flipper.register :admins do |actor| actor.admin? end Flipper.enable :search Flipper.enable_actor :stats, user1 Flipper.enable_percentage_of_actors :pro_stats, 50 Flipper.enable_group :tweets, :admins Flipper.enable_actor :posts, user2 pp Flipper.features.select { |feature| feature.enabled?(user1) }.map(&:name) pp Flipper.features.select { |feature| feature.enabled?(user2) }.map(&:name)
Version data entries
22 entries across 22 versions & 1 rubygems