Class: Modesty::Experiment::Interface
- Inherits:
-
Object
- Object
- Modesty::Experiment::Interface
- Defined in:
- lib/modesty/experiment/interface.rb
Overview
the thing yielded when you say ‘Modesty.experiment :foo do |e| …`
Instance Attribute Summary collapse
-
#last_value ⇒ Object
readonly
Returns the value of attribute last_value.
Instance Method Summary collapse
- #group(gr = nil) ⇒ Object
- #group?(alt) ⇒ Boolean
-
#initialize(exp, identity) ⇒ Interface
constructor
A new instance of Interface.
Constructor Details
#initialize(exp, identity) ⇒ Interface
Returns a new instance of Interface.
5 6 7 8 |
# File 'lib/modesty/experiment/interface.rb', line 5 def initialize(exp, identity) @exp = exp @alt = exp.group(identity) end |
Instance Attribute Details
#last_value ⇒ Object (readonly)
Returns the value of attribute last_value.
10 11 12 |
# File 'lib/modesty/experiment/interface.rb', line 10 def last_value @last_value end |
Instance Method Details
#group(gr = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/modesty/experiment/interface.rb', line 12 def group(gr=nil) if block_given? if gr && @exp.group == gr @last_value = yield else @last_value end else @exp.group end end |
#group?(alt) ⇒ Boolean
24 25 26 |
# File 'lib/modesty/experiment/interface.rb', line 24 def group?(alt) alt == @alt end |