Class: Split::EncapsulatedHelper::ContextShim

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/split/encapsulated_helper.rb

Constant Summary

Constants included from Helper

Helper::OVERRIDE_PARAM_NAME

Instance Method Summary collapse

Methods included from Helper

ab_active_experiments, ab_finished, ab_record_extra_info, ab_test, ab_user, active_experiments, control_variable, exclude_visitor?, finish_experiment, is_ignored_ip_address?, is_preview?, is_robot?, normalize_metric, override_alternative, override_alternative_by_cookies, override_alternative_by_params, override_present?, params_present?, request_present?, reset!, split_generically_disabled?

Constructor Details

#initialize(context) ⇒ ContextShim

Returns a new instance of ContextShim.



22
23
24
# File 'lib/split/encapsulated_helper.rb', line 22

def initialize(context)
  @context = context
end

Instance Method Details

#ab_userObject



34
35
36
# File 'lib/split/encapsulated_helper.rb', line 34

def ab_user
  @ab_user ||= Split::User.new(@context)
end

#paramsObject



26
27
28
# File 'lib/split/encapsulated_helper.rb', line 26

def params
  request.params if request && request.respond_to?(:params)
end

#requestObject



30
31
32
# File 'lib/split/encapsulated_helper.rb', line 30

def request
  @context.request if @context.respond_to?(:request)
end