Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 30 lines (21 sloc) 0.691 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
require './example_setup'

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
end

user1 = User.new(1)
user2 = User.new(2)

puts "Stats for user1: #{stats.enabled?(flipper.actor(user1))}"
puts "Stats for user2: #{stats.enabled?(flipper.actor(user2))}"

puts "\nEnabling stats for user1...\n\n"
stats.enable(flipper.actor(user1))

puts "Stats for user1: #{stats.enabled?(flipper.actor(user1))}"
puts "Stats for user2: #{stats.enabled?(flipper.actor(user2))}"
Something went wrong with that request. Please try again.