determinator 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 032d0d611e857b800335e89ac9072d019a882068
4
- data.tar.gz: 78c11ba6dc7f2b4ac655ce640de7eb1b9952969b
3
+ metadata.gz: 066363028ac1046f4d723b50c600c4f32482573e
4
+ data.tar.gz: 9335a928b7c7ff5bc090fea102eaee6de44b335a
5
5
  SHA512:
6
- metadata.gz: fae0cba5e7b20502e07c0e063fa1508644831e581c20622166316d265b4ecd2dcd28e5dfd542a4c8dd8754080792772fdc399baeab516d811d5848bce7c98b73
7
- data.tar.gz: a30b9e35eef5a9fa3963620c14d21f5b77836117ad2f8b2553c85517c32bdb4a78cb03d5b6c3f213978a8c3dcab4058a0493492341ac5dc8d0bf35b3f2042c99
6
+ metadata.gz: b2160f41cf9f742948933bfae8fca2f64e6c051e7bfc4320f04148e47fbc78f1bf9b55a258fb8cd16e640a05197fc8c866881597a682041e97e0d9d526c0ccee
7
+ data.tar.gz: fb1501b19164f5a70260930c32828a45ba31f39c6610c2cc4c792e309e53ed6e735dd776fbcd7b8bfbd74b34410d83c55d061a6a08fd75721d9e7f7aa43892e5
@@ -103,6 +103,8 @@ module Determinator
103
103
  end
104
104
 
105
105
  def variant_for(feature, indicator)
106
+ return feature.winning_variant if feature.winning_variant
107
+
106
108
  # Scale up the weights so the variants fit within the possible space for the variant indicator
107
109
  variant_weight_total = feature.variants.values.reduce(:+)
108
110
  scale_factor = 65_535 / variant_weight_total.to_f
@@ -3,15 +3,16 @@ module Determinator
3
3
  #
4
4
  # @attr_reader [nil,Hash<String,Integer>] variants The variants for this experiment, with the name of the variant as the key and the weight as the value. Will be nil for non-experiments.
5
5
  class Feature
6
- attr_reader :name, :identifier, :bucket_type, :variants, :target_groups, :active
6
+ attr_reader :name, :identifier, :bucket_type, :variants, :target_groups, :active, :winning_variant
7
7
 
8
8
  BUCKET_TYPES = %i(id guid fallback)
9
9
 
10
- def initialize(name:, identifier:, bucket_type:, target_groups:, variants: {}, overrides: {}, active: false)
10
+ def initialize(name:, identifier:, bucket_type:, target_groups:, variants: {}, overrides: {}, active: false, winning_variant: nil)
11
11
  @name = name.to_s
12
12
  @identifier = identifier.to_s
13
13
  @variants = variants
14
14
  @target_groups = target_groups
15
+ @winning_variant = winning_variant
15
16
  @active = active
16
17
 
17
18
  @bucket_type = bucket_type.to_sym
@@ -53,7 +53,8 @@ module Determinator
53
53
  variants: obj.body.variants.to_h,
54
54
  overrides: obj.body.overrides.each_with_object({}) { |override, hash|
55
55
  hash[override.user_id] = override.variant
56
- }
56
+ },
57
+ winning_variant: obj.body.winning_variant,
57
58
  )
58
59
  rescue ::Routemaster::Errors::ResourceNotFound
59
60
  nil
@@ -1,3 +1,3 @@
1
1
  module Determinator
2
- VERSION = "0.6.2"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: determinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Hastings-Spital
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-06 00:00:00.000000000 Z
11
+ date: 2017-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: routemaster-drain
@@ -202,8 +202,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  version: '0'
203
203
  requirements: []
204
204
  rubyforge_project:
205
- rubygems_version: 2.6.8
205
+ rubygems_version: 2.5.1
206
206
  signing_key:
207
207
  specification_version: 4
208
208
  summary: Determine which experiments and features a specific actor should see.
209
209
  test_files: []
210
+ has_rdoc: