Module: RubyOptimize::ActionViewExtension

Includes:
CommonControllersAndHelpers
Defined in:
lib/ruby_optimize/helpers/action_view_extension.rb

Instance Method Summary collapse

Methods included from CommonControllersAndHelpers

#ruby_optimize

Instance Method Details

#ruby_optimize_wrap(*version_and_scope, **params, &block) ⇒ Object



5
6
7
8
9
10
# File 'lib/ruby_optimize/helpers/action_view_extension.rb', line 5

def ruby_optimize_wrap(*version_and_scope, **params, &block)
  scope = version_and_scope[1] || :default
  raise "RubyOptimize - A/B test not initialized" if @ruby_optimize.nil?
  raise "RubyOptimize - scope not found: #{scope.inspect}" if !@ruby_optimize.has_key?(scope)
  @ruby_optimize[scope].show?(version_and_scope[0], !!params[:version_for_crawler]) ? capture(&block).html_safe : ''
end