Module: Bandit::ControllerConcerns::InstanceMethods
- Defined in:
- lib/bandit/extensions/controller_concerns.rb
Instance Method Summary collapse
-
#bandit_convert!(exp, alt = nil, count = 1) ⇒ Object
FIXME: deprecated (for compatibility with bandit gem & older bandido versions) ——————————————————————————.
- #bandit_final_convert!(exp, alt = nil, count = 1) ⇒ Object
-
#bandit_session_convert!(exp, alt = nil, count = 1) ⇒ Object
expects a session cookie, deletes it, will convert again.
-
#bandit_simple_convert!(exp, alt, count = 1) ⇒ Object
look mum, no cookies.
-
#bandit_sticky_convert!(exp, alt = nil, count = 1) ⇒ Object
creates a _converted cookie, prevents multiple conversions.
Instance Method Details
#bandit_convert!(exp, alt = nil, count = 1) ⇒ Object
FIXME: deprecated (for compatibility with bandit gem & older bandido versions)
40 41 42 |
# File 'lib/bandit/extensions/controller_concerns.rb', line 40 def bandit_convert!(exp, alt=nil, count=1) bandit_session_convert!(exp, alt, count) end |
#bandit_final_convert!(exp, alt = nil, count = 1) ⇒ Object
44 45 46 |
# File 'lib/bandit/extensions/controller_concerns.rb', line 44 def bandit_final_convert!(exp, alt=nil, count=1) bandit_sticky_convert!(exp, alt, count) end |
#bandit_session_convert!(exp, alt = nil, count = 1) ⇒ Object
expects a session cookie, deletes it, will convert again
17 18 19 20 21 22 23 24 25 |
# File 'lib/bandit/extensions/controller_concerns.rb', line 17 def bandit_session_convert!(exp, alt=nil, count=1) = "bandit_#{exp}".intern = "bandit_#{exp}_converted".intern alt ||= .signed[] unless alt.nil? or .signed[] Bandit.get_experiment(exp).convert!(alt, count) .delete() end end |
#bandit_simple_convert!(exp, alt, count = 1) ⇒ Object
look mum, no cookies
12 13 14 |
# File 'lib/bandit/extensions/controller_concerns.rb', line 12 def bandit_simple_convert!(exp, alt, count=1) Bandit.get_experiment(exp).convert!(alt, count) end |
#bandit_sticky_convert!(exp, alt = nil, count = 1) ⇒ Object
creates a _converted cookie, prevents multiple conversions
28 29 30 31 32 33 34 35 36 |
# File 'lib/bandit/extensions/controller_concerns.rb', line 28 def bandit_sticky_convert!(exp, alt=nil, count=1) = "bandit_#{exp}".intern = "bandit_#{exp}_converted".intern alt ||= .signed[] unless alt.nil? or .signed[] .permanent.signed[] = "true" Bandit.get_experiment(exp).convert!(alt, count) end end |