Sha256: ef087e63591e8286054c8ef242955f9dc91afdff399351f850d429320f1ddd25
Contents?: true
Size: 559 Bytes
Versions: 1
Compression:
Stored size: 559 Bytes
Contents
require 'digest' module CanaryLabs module Resolvers class Percentage def initialize(percentage, beta_name) @percentage = percentage @beta_name = beta_name end def participating? id # create a deterministic number based on the item identifier and # name of the beta. This will evenly distribute exposure to beta's # across all ID's. determ_num = Digest::MD5.hexdigest(id.to_s + @beta_name.to_s).to_i(16) (determ_num % (@percentage * 100).to_i).zero? end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
canary_labs-0.4.0 | lib/resolvers/percentage.rb |