Class: Absurdity::Datastore
- Inherits:
-
Object
- Object
- Absurdity::Datastore
- Defined in:
- lib/absurdity/datastore.rb
Direct Known Subclasses
Constant Summary collapse
- PARSE_AS_JSON =
[ :metrics_list, :variants_list, :experiments_list ]
Class Method Summary collapse
Class Method Details
.all(klass) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/absurdity/datastore.rb', line 20 def self.all(klass) if klass == Absurdity::Experiment all_experiments elsif klass == Absurdity::Metric all_metrics elsif klass == Absurdity::Variant all_variants end end |
.find(klass, options) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/absurdity/datastore.rb', line 30 def self.find(klass, ) if klass == Absurdity::Experiment find_experiment([:slug]) elsif klass == Absurdity::Metric find_metric([:slug], [:experiment_slug], [:variant_slug]) elsif klass == Absurdity::Variant find_variant([:identity_id], [:experiment_slug]) end end |
.save(object) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/absurdity/datastore.rb', line 9 def self.save(object) klass = object.class if klass == Absurdity::Experiment save_experiment(object) elsif klass == Absurdity::Metric save_metric(object) elsif klass == Absurdity::Variant save_variant(object) end end |