Sha256: c3ae805d2033d2aca17c1a8c51f0f9501af3624178fac25d13e650fc486ce66a

Contents?: true

Size: 675 Bytes

Versions: 16

Compression:

Stored size: 675 Bytes

Contents

require File.expand_path('../example_setup', __FILE__)

require 'flipper'

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

16 entries across 16 versions & 1 rubygems

Version Path
flipper-0.20.4 examples/individual_actor.rb
flipper-0.20.3 examples/individual_actor.rb
flipper-0.20.2 examples/individual_actor.rb
flipper-0.20.1 examples/individual_actor.rb
flipper-0.20.0 examples/individual_actor.rb
flipper-0.20.0.beta3 examples/individual_actor.rb
flipper-0.20.0.beta2 examples/individual_actor.rb
flipper-0.20.0.beta1 examples/individual_actor.rb
flipper-0.19.1 examples/individual_actor.rb
flipper-0.19.0 examples/individual_actor.rb
flipper-0.18.0 examples/individual_actor.rb
flipper-0.17.2 examples/individual_actor.rb
flipper-0.17.1 examples/individual_actor.rb
flipper-0.16.2 examples/individual_actor.rb
flipper-0.16.1 examples/individual_actor.rb
flipper-0.16.0 examples/individual_actor.rb