Class: Trebuchet::Strategy::Experiment

Inherits:
Base
  • Object
show all
Includes:
Experimentable
Defined in:
lib/trebuchet/strategy/experiment.rb

Overview

require ‘digest/sha1’

Instance Attribute Summary

Attributes included from Experimentable

#bucket, #experiment_name, #total_buckets

Attributes inherited from Base

#feature

Instance Method Summary collapse

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, #needs_user?, strategy_name

Constructor Details

#initialize(options = {}) ⇒ Experiment

Returns a new instance of Experiment.



7
8
9
# File 'lib/trebuchet/strategy/experiment.rb', line 7

def initialize(options = {})
  initialize_experiment(options)
end

Instance Method Details

#launch_at?(user, request = nil) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/trebuchet/strategy/experiment.rb', line 11

def launch_at?(user, request = nil)
  return false unless user && user.id
  value_in_bucket?(user.id)
end