lib/eeny-meeny/models/experiment.rb in eeny-meeny-2.2.1 vs lib/eeny-meeny/models/experiment.rb in eeny-meeny-2.2.2

- old
+ new

@@ -8,15 +8,17 @@ COOKIE_EXPERIMENT_ID_REGEX = /\Aeeny_meeny_(.+)_v\d+\z/.freeze attr_reader :id, :name, :version, :variations, :total_weight, :end_at, :start_at def self.find_all + return [] unless EenyMeeny.config.experiments EenyMeeny.config.experiments.map do |id, experiment| new(id, **experiment) end end def self.find_by_id(experiment_id) + return unless EenyMeeny.config.experiments experiment = EenyMeeny.config.experiments[experiment_id.to_sym] new(experiment_id, **experiment) if experiment end def self.find_by_cookie_name(cookie_name)