determinator 2.9.0 → 2.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/determinator/control.rb +23 -1
- data/lib/determinator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 227a75590dfa088f7096c65a51ab2d2950f9605ed3f29c7d62119df86e2c3721
|
4
|
+
data.tar.gz: 77c7e9ae41428c7e898f3dca7464d6987210379723bd8bc73906a8c73cbd62d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59fcec1ac83528e76f9ccdfb5985732d336fc6bb177055a4d5c02a4929f20c98b1a6052c96fa3397430c40d40733b4b8fb2fb801db041a3a125db64bd68276cf
|
7
|
+
data.tar.gz: dc73504e3e55e79d10a0939e3a32f16525523b8e480da280aae2a0400b578b3e04cb893ef593967767ffab88370ef118310d37b7df906cc48ea547dcb8570e91
|
data/CHANGELOG.md
CHANGED
data/lib/determinator/control.rb
CHANGED
@@ -72,6 +72,20 @@ module Determinator
|
|
72
72
|
'#<Determinator::Control>'
|
73
73
|
end
|
74
74
|
|
75
|
+
# Defines code that should execute when a determination is completed. This is particularly
|
76
|
+
# helpful for comparing determinations made by this control with other mechanisms.
|
77
|
+
#
|
78
|
+
# Please note that this block will be executed _synchronously_ before delivering the determination to the callsite.
|
79
|
+
#
|
80
|
+
# @yield [name, arguments, determination] Will be called when a determination was requested for the
|
81
|
+
# specified feature with `name`, with the given keyword arguments.
|
82
|
+
# @yieldparam name [String, nil] The name of the feature
|
83
|
+
# @yieldparam args [Hash] The keyword arguments passed to the determination method. This includes :id, :guid, :properties.
|
84
|
+
# @yieldparam determination [String,Boolean] The result of the determination
|
85
|
+
def on_determination(&block)
|
86
|
+
@determination_callback = block
|
87
|
+
end
|
88
|
+
|
75
89
|
private
|
76
90
|
|
77
91
|
Indicators = Struct.new(:rollout, :variant)
|
@@ -81,12 +95,15 @@ module Determinator
|
|
81
95
|
|
82
96
|
if feature.nil? || feature.is_a?(ErrorResponse) || feature.is_a?(MissingResponse)
|
83
97
|
Determinator.notice_missing_feature(name)
|
98
|
+
run_determination_callback(name, {id: id, guid: guid, properties: properties}, false)
|
84
99
|
return false
|
85
100
|
end
|
86
101
|
|
87
|
-
determinate(feature, id: id, guid: guid, properties: properties).tap do |determination|
|
102
|
+
result = determinate(feature, id: id, guid: guid, properties: properties).tap do |determination|
|
88
103
|
Determinator.notice_determination(id, guid, feature, determination)
|
89
104
|
end
|
105
|
+
run_determination_callback(name, {id: id, guid: guid, properties: properties}, result)
|
106
|
+
result
|
90
107
|
end
|
91
108
|
|
92
109
|
def determinate(feature, id:, guid:, properties:)
|
@@ -320,5 +337,10 @@ module Determinator
|
|
320
337
|
hash[name.to_s] = [*values].map(&:to_s)
|
321
338
|
end
|
322
339
|
end
|
340
|
+
|
341
|
+
def run_determination_callback(name, args, determination)
|
342
|
+
return unless @determination_callback
|
343
|
+
@determination_callback.call(name, args, determination)
|
344
|
+
end
|
323
345
|
end
|
324
346
|
end
|
data/lib/determinator/version.rb
CHANGED
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: 2.9.
|
4
|
+
version: 2.9.1
|
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: 2022-
|
11
|
+
date: 2022-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|