verdict 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Gemfile +4 -0
- data/README.md +56 -33
- data/lib/verdict.rb +2 -1
- data/lib/verdict/experiment.rb +15 -7
- data/lib/verdict/segmenters.rb +4 -0
- data/lib/verdict/segmenters/base_segmenter.rb +84 -0
- data/lib/verdict/segmenters/fixed_percentage_segmenter.rb +56 -0
- data/lib/verdict/segmenters/rollout_segmenter.rb +55 -0
- data/lib/verdict/segmenters/static_segmenter.rb +27 -0
- data/lib/verdict/storage.rb +3 -138
- data/lib/verdict/storage/memory_storage.rb +40 -0
- data/lib/verdict/storage/mock_storage.rb +38 -0
- data/lib/verdict/storage/redis_storage.rb +62 -0
- data/lib/verdict/tasks.rake +8 -8
- data/lib/verdict/version.rb +1 -1
- data/test/assignment_test.rb +4 -4
- data/test/conversion_test.rb +1 -1
- data/test/event_logger_test.rb +1 -1
- data/test/experiment_test.rb +12 -3
- data/test/experiments_repository_test.rb +1 -1
- data/test/group_test.rb +2 -2
- data/test/metadata_test.rb +1 -1
- data/test/{fixed_percentage_segmenter_test.rb → segmenters/fixed_percentage_segmenter_test.rb} +11 -11
- data/test/{rollout_segmenter_test.rb → segmenters/rollout_segmenter_test.rb} +2 -2
- data/test/{static_segmenter_test.rb → segmenters/static_segmenter_test.rb} +2 -2
- data/test/{memory_subject_storage_test.rb → storage/memory_subject_storage_test.rb} +1 -1
- data/test/{redis_subject_storage_test.rb → storage/redis_subject_storage_test.rb} +2 -2
- data/test/test_helper.rb +8 -0
- data/verdict.gemspec +6 -6
- metadata +24 -19
- data/lib/verdict/fixed_percentage_segmenter.rb +0 -52
- data/lib/verdict/rollout_segmenter.rb +0 -53
- data/lib/verdict/segmenter.rb +0 -87
- data/lib/verdict/static_segmenter.rb +0 -24
@@ -1,24 +0,0 @@
|
|
1
|
-
class Verdict::StaticSegmenter < Verdict::Segmenter
|
2
|
-
|
3
|
-
class Group < Verdict::Group
|
4
|
-
|
5
|
-
attr_reader :subject_identifiers
|
6
|
-
|
7
|
-
def initialize(experiment, handle, subject_identifiers)
|
8
|
-
super(experiment, handle)
|
9
|
-
@subject_identifiers = subject_identifiers
|
10
|
-
end
|
11
|
-
|
12
|
-
def as_json(options = {})
|
13
|
-
super(options).merge(subject_identifiers: subject_identifiers)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def register_group(handle, subject_identifiers)
|
18
|
-
Group.new(experiment, handle, subject_identifiers)
|
19
|
-
end
|
20
|
-
|
21
|
-
def assign(identifier, subject, context)
|
22
|
-
groups.values.find { |group| group.subject_identifiers.include?(identifier) }
|
23
|
-
end
|
24
|
-
end
|