Module: AbingoViewHelper

Defined in:
lib/abingo_view_helper.rb

Overview

Gives you easy syntax to use ABingo in your views.

Instance Method Summary collapse

Instance Method Details

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



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/abingo_view_helper.rb', line 5

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



38
39
40
# File 'lib/abingo_view_helper.rb', line 38

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