Class: TrailGuide::Experiments::Participant
- Inherits:
-
Object
- Object
- TrailGuide::Experiments::Participant
show all
- Defined in:
- lib/trail_guide/experiments/participant.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(experiment, participant) ⇒ Participant
6
7
8
9
|
# File 'lib/trail_guide/experiments/participant.rb', line 6
def initialize(experiment, participant)
@experiment = experiment
@participant = participant
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
43
44
45
46
|
# File 'lib/trail_guide/experiments/participant.rb', line 43
def method_missing(meth, *args, &block)
return participant.send(meth, *args, &block) if participant.respond_to?(meth, true)
super
end
|
Instance Attribute Details
#experiment ⇒ Object
Returns the value of attribute experiment.
4
5
6
|
# File 'lib/trail_guide/experiments/participant.rb', line 4
def experiment
@experiment
end
|
#participant ⇒ Object
Returns the value of attribute participant.
4
5
6
|
# File 'lib/trail_guide/experiments/participant.rb', line 4
def participant
@participant
end
|
Instance Method Details
#converted!(variant, checkpoint, reset: false) ⇒ Object
26
27
28
29
30
|
# File 'lib/trail_guide/experiments/participant.rb', line 26
def converted!(variant, checkpoint, reset: false)
@converted ||= {}
@converted[checkpoint || :converted] ||= true
participant.converted!(variant, checkpoint, reset: reset)
end
|
#converted?(checkpoint = nil) ⇒ Boolean
21
22
23
24
|
# File 'lib/trail_guide/experiments/participant.rb', line 21
def converted?(checkpoint=nil)
@converted ||= {}
@converted[checkpoint || :converted] ||= participant.converted?(experiment, checkpoint)
end
|
#exit! ⇒ Object
36
37
38
39
40
41
|
# File 'lib/trail_guide/experiments/participant.rb', line 36
def exit!
@participating = nil
@converted = nil
@variant = nil
participant.exit!(experiment)
end
|
#participating!(variant) ⇒ Object
15
16
17
18
19
|
# File 'lib/trail_guide/experiments/participant.rb', line 15
def participating!(variant)
@participating = true
@variant = variant
participant.participating!(variant) if experiment.configuration.store_participation?
end
|
#participating? ⇒ Boolean
11
12
13
|
# File 'lib/trail_guide/experiments/participant.rb', line 11
def participating?
@participating ||= variant.present?
end
|
#respond_to_missing?(meth, include_private = false) ⇒ Boolean
48
49
50
|
# File 'lib/trail_guide/experiments/participant.rb', line 48
def respond_to_missing?(meth, include_private=false)
participant.respond_to?(meth, include_private)
end
|
#variant ⇒ Object
32
33
34
|
# File 'lib/trail_guide/experiments/participant.rb', line 32
def variant
@variant ||= participant.variant(experiment)
end
|