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 34 lines (25 sloc) 0.676 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 30 31 32 33
require './example_setup'

require 'flipper'
require 'flipper/adapters/memory'

adapter = Flipper::Adapters::Memory.new
flipper = Flipper.new(adapter)
logging = flipper[:logging]

perform_test = lambda do |number|
  logging.enable flipper.random(number)

  total = 1_000
  enabled = []
  disabled = []

  (1..total).each do |number|
    if logging.enabled?
      enabled << number
    else
      disabled << number
    end
  end

  actual = (enabled.size / total.to_f * 100).round(2)

  # puts "#{enabled.size} / #{total}"
  puts "percentage: #{actual} vs #{number}"
end

[1, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 99, 100].each do |number|
  perform_test.call number
end
Something went wrong with that request. Please try again.