Class Abingo
In: lib/camping-abingo.rb
Parent: Object

Main Abingo class


Public Class methods

Scores conversions for tests. test_name_or_array supports three types of input:

A conversion name: scores a conversion for any test the user is participating in which

  is listening to the specified conversion.

A test name: scores a conversion for the named test if the user is participating in it.

An array of either of the above: for each element of the array, process as above.

nil: score a conversion for every test the u

A simple convenience method for doing an A/B test. Returns true or false. If you pass it a block, it will bind the choice to the variable given to the block.

Marks that this user is human.

This method gives a unique identity to a user. It can be absolutely anything you want, as long as it is consistent.

We use the identity to determine, deterministically, which alternative a user sees. This means that if you use Abingo.identify_user on someone at login, they will always see the same alternative for a particular test which is past the login screen. For details and usage notes, see the docs.

This is the meat of A/Bingo. options accepts

  :multiple_participation (true or false)
  :conversion  name of conversion to listen for  (alias: conversion_name)

Protected Class methods

Quickly determines what alternative to show a given user. Given a test name and their identity, we hash them together (which, for MD5, provably introduces enough entropy that we don‘t care) otherwise

For programmer convenience, we allow you to specify what the alternatives for an experiment are in a few ways. Thus, we need to actually be able to handle all of them. We fire this parser very infrequently (once per test, typically) so it can be as complicated as we want.

   Integer => a number 1 through N
   Range   => a number within the range
   Array   => an element of the array.
   Hash    => assumes a hash of something to int.  We pick one of the
              somethings, weighted accorded to the ints provided.  e.g.
              {:a => 2, :b => 3} produces :a 40% of the time, :b 60%.

Alternatives are always represented internally as an array.