Sha256: 80bd5d00145ce4aaf054abdd0c61ba9aaccb97b2d516633b78b161db22d1d766

Contents?: true

Size: 645 Bytes

Versions: 1

Compression:

Stored size: 645 Bytes

Contents

require 'feature'

require 'resolvers/group'
require 'resolvers/percentage'

module CanaryLabs
  mattr_accessor :default_participation

  def self.setup default_participation: true
    @@experiments = {}
    @@default_participation = default_participation
  end

  def self.participating? feat_name, id
    experiment = @@experiments[feat_name]

    return @@default_participation if experiment.nil?

    experiment.participating? id
  end

  def self.add name, desc, resolver
    @@experiments[name] = Feature.new name, desc, resolver
  end

  def self.find name
    @@experiments[name]
  end

  def self.all
    @@experiments.values
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
canary_labs-0.4.0 lib/canary_labs.rb