Class: CanaryLabs::ExperimentRepo
- Inherits:
-
Object
- Object
- CanaryLabs::ExperimentRepo
- Defined in:
- lib/experiment_repo.rb
Instance Attribute Summary collapse
-
#default_participation ⇒ Object
readonly
Returns the value of attribute default_participation.
Instance Method Summary collapse
- #add(name, desc, resolver) ⇒ Object
- #all ⇒ Object
- #find(name) ⇒ Object
-
#initialize(default_participation: true) ⇒ ExperimentRepo
constructor
A new instance of ExperimentRepo.
- #participating?(beta_name, id) ⇒ Boolean
Constructor Details
#initialize(default_participation: true) ⇒ ExperimentRepo
Returns a new instance of ExperimentRepo.
5 6 7 8 |
# File 'lib/experiment_repo.rb', line 5 def initialize default_participation: true @betas = {} @default_participation = default_participation end |
Instance Attribute Details
#default_participation ⇒ Object (readonly)
Returns the value of attribute default_participation.
3 4 5 |
# File 'lib/experiment_repo.rb', line 3 def default_participation @default_participation end |
Instance Method Details
#add(name, desc, resolver) ⇒ Object
18 19 20 |
# File 'lib/experiment_repo.rb', line 18 def add name, desc, resolver @betas[name] = Feature.new name, desc, resolver end |
#all ⇒ Object
26 27 28 |
# File 'lib/experiment_repo.rb', line 26 def all @betas.values end |
#find(name) ⇒ Object
22 23 24 |
# File 'lib/experiment_repo.rb', line 22 def find name @betas[name] end |
#participating?(beta_name, id) ⇒ Boolean
10 11 12 13 14 15 16 |
# File 'lib/experiment_repo.rb', line 10 def participating? beta_name, id b = @betas[beta_name] return @default_participation if b.nil? b.participating? id end |