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

Version Path
flipper-0.15.0 examples/individual_actor.rb
flipper-0.14.0 examples/individual_actor.rb
flipper-0.13.0 examples/individual_actor.rb
flipper-0.13.0.beta1 examples/individual_actor.rb
flipper-0.12.2 examples/individual_actor.rb
flipper-0.12.1 examples/individual_actor.rb
flipper-0.12.0 examples/individual_actor.rb
flipper-0.11.0 examples/individual_actor.rb
flipper-0.11.0.rc1 examples/individual_actor.rb
flipper-0.11.0.beta9 examples/individual_actor.rb
flipper-0.11.0.beta8 examples/individual_actor.rb
flipper-0.11.0.beta7 examples/individual_actor.rb
flipper-0.11.0.beta6 examples/individual_actor.rb
flipper-0.11.0.beta5 examples/individual_actor.rb
flipper-0.11.0.beta4 examples/individual_actor.rb
flipper-0.11.0.beta3 examples/individual_actor.rb
flipper-0.11.0.beta1 examples/individual_actor.rb
flipper-0.10.2 examples/individual_actor.rb
flipper-0.10.1 examples/individual_actor.rb
flipper-0.10.0 examples/individual_actor.rb