Sha256: 7f91d5e1085eae153e047ce10024201cbddaec47363646e64b64c05e16f95e44
Contents?: true
Size: 709 Bytes
Versions: 43
Compression:
Stored size: 709 Bytes
Contents
require File.expand_path('../example_setup', __FILE__) require 'flipper' require 'flipper/adapters/memory' adapter = Flipper::Adapters::Memory.new flipper = Flipper.new(adapter) stats = flipper[:stats] # Some class that represents what will be trying to do something class User attr_reader :id def initialize(id) @id = id end # Must respond to flipper_id alias_method :flipper_id, :id end user1 = User.new(1) user2 = User.new(2) puts "Stats for user1: #{stats.enabled?(user1)}" puts "Stats for user2: #{stats.enabled?(user2)}" puts "\nEnabling stats for user1...\n\n" stats.enable(user1) puts "Stats for user1: #{stats.enabled?(user1)}" puts "Stats for user2: #{stats.enabled?(user2)}"
Version data entries
43 entries across 43 versions & 1 rubygems