Class: Trebuchet::Strategy::VisitorExperiment
- Includes:
- Experimentable
- Defined in:
- lib/trebuchet/strategy/visitor_experiment.rb
Instance Attribute Summary
Attributes included from Experimentable
#bucket, #experiment_name, #total_buckets
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ VisitorExperiment
constructor
A new instance of VisitorExperiment.
- #launch_at?(user, request = nil) ⇒ Boolean
- #needs_user? ⇒ Boolean
Methods included from Experimentable
#as_json, #export, #initialize_experiment, #inspect, #to_s, #type, #valid?, #value_in_bucket?
Methods inherited from Base
#as_json, #export, #feature_id, #inspect, #name, strategy_name
Constructor Details
#initialize(options = {}) ⇒ VisitorExperiment
Returns a new instance of VisitorExperiment.
5 6 7 |
# File 'lib/trebuchet/strategy/visitor_experiment.rb', line 5 def initialize( = {}) initialize_experiment() end |
Instance Method Details
#launch_at?(user, request = nil) ⇒ Boolean
9 10 11 12 13 14 15 16 17 |
# File 'lib/trebuchet/strategy/visitor_experiment.rb', line 9 def launch_at?(user, request = nil) if Trebuchet.visitor_id.respond_to?(:call) visitor_id = Trebuchet.visitor_id.call(request) else visitor_id = nil end return false if visitor_id.nil? value_in_bucket?(visitor_id) end |
#needs_user? ⇒ Boolean
19 20 21 |
# File 'lib/trebuchet/strategy/visitor_experiment.rb', line 19 def needs_user? false end |