Module: Vanity::Helpers
- Defined in:
- lib/vanity/helpers.rb
Overview
Helper methods available on Object.
Instance Method Summary collapse
-
#ab_test(name, &block) ⇒ Object
This method returns one of the alternative values in the named A/B test.
-
#track!(name, count = 1) ⇒ Object
Tracks an action associated with a metric.
Instance Method Details
#ab_test(name, &block) ⇒ Object
This method returns one of the alternative values in the named A/B test.
36 37 38 39 40 41 42 43 44 |
# File 'lib/vanity/helpers.rb', line 36 def ab_test(name, &block) value = Vanity.playground.experiment(name).choose if block content = capture(value, &block) block_called_from_erb?(block) ? concat(content) : content else value end end |
#track!(name, count = 1) ⇒ Object
Tracks an action associated with a metric.
51 52 53 |
# File 'lib/vanity/helpers.rb', line 51 def track!(name, count = 1) Vanity.playground.track! name, count end |