Module: AbingoSugar

Defined in:
lib/abingo_sugar.rb

Overview

This module exists entirely to save finger strain for programmers. It is designed to be included in your ApplicationController.

See abingo.rb for descriptions of what these do.

Instance Method Summary collapse

Instance Method Details

#ab_test(test_name, alternatives = nil, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/abingo_sugar.rb', line 8

def ab_test(test_name, alternatives = nil, options = {})
  if (Abingo.options[:enable_specification] && !params[test_name].blank?)
    choice = params[test_name]
  elsif (alternatives.nil?)
    choice = Abingo.flip(test_name)
  else
    choice = Abingo.test(test_name, alternatives, options)
  end

  if block_given?
    yield(choice)
  else
    choice
  end
end

#bingo!(test_name, options = {}) ⇒ Object



24
25
26
# File 'lib/abingo_sugar.rb', line 24

def bingo!(test_name, options = {})
  Abingo.bingo!(test_name, options)
end