Class: Ablab::Experiment
- Inherits:
-
Object
- Object
- Ablab::Experiment
- Defined in:
- lib/ablab.rb
Instance Attribute Summary collapse
-
#control ⇒ Object
readonly
Returns the value of attribute control.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #description(desc = nil) ⇒ Object
- #goal(goal = nil) ⇒ Object
- #group(name, options = {}) ⇒ Object
-
#initialize(name, &block) ⇒ Experiment
constructor
A new instance of Experiment.
- #percentage_of_visitors(percentage = nil) ⇒ Object
- #results ⇒ Object
- #run(session_id) ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Experiment
Returns a new instance of Experiment.
51 52 53 54 55 56 |
# File 'lib/ablab.rb', line 51 def initialize(name, &block) @name = name.to_sym @control = Group.new(:control, 'control group') @groups = [@control] instance_exec(&block) end |
Instance Attribute Details
#control ⇒ Object (readonly)
Returns the value of attribute control.
49 50 51 |
# File 'lib/ablab.rb', line 49 def control @control end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
49 50 51 |
# File 'lib/ablab.rb', line 49 def groups @groups end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
49 50 51 |
# File 'lib/ablab.rb', line 49 def name @name end |
Instance Method Details
#description(desc = nil) ⇒ Object
58 59 60 61 |
# File 'lib/ablab.rb', line 58 def description(desc = nil) @description = desc if desc @description end |
#goal(goal = nil) ⇒ Object
63 64 65 66 |
# File 'lib/ablab.rb', line 63 def goal(goal = nil) @goal = goal if goal @goal end |
#group(name, options = {}) ⇒ Object
73 74 75 76 |
# File 'lib/ablab.rb', line 73 def group(name, = {}) group = Group.new(name, [:description]) @groups << group end |
#percentage_of_visitors(percentage = nil) ⇒ Object
68 69 70 71 |
# File 'lib/ablab.rb', line 68 def percentage_of_visitors(percentage = nil) @percentage_of_visitors = percentage if percentage @percentage_of_visitors || 100 end |