amplitude-experiment 1.1.2 → 1.1.3
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 +4 -4
- data/README.md +2 -1
- data/lib/experiment/factory.rb +4 -9
- data/lib/experiment/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: 79931b2e41b024a2ae5503ff41321635959bfe3ea12ebdec92d565c03ef75072
|
4
|
+
data.tar.gz: f7247ded087e26ad540f22e3e306c8870c33c241e408f214c98839020acddccc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be36e288fa8892698c510b810580834445f75959511ea15b38fec4b079ca91235c920a27ed9ce6f69c6e05609d2b31db6c79cd0d888e59dde68eb7c74e849cf1
|
7
|
+
data.tar.gz: a2d892e60a65bd0f9a4b85d8994aeb26bf9b27d97a7397b8d6999aa408797d84f534d25d9d3a6c967def88c0ee0d313bc349dddd1f5b0a45224e65a656261c9b
|
data/README.md
CHANGED
@@ -10,6 +10,8 @@
|
|
10
10
|
# Experiment Ruby SDK
|
11
11
|
Amplitude Ruby Server SDK for Experiment.
|
12
12
|
|
13
|
+
> ⚠️ **Local evaluation process fork safety:** When using a `LocalEvaluationClient` and forking the process, you must call `#start` _after forking_ to update the flag configuration state on the new process. For example, in Puma, this means calling `#start` in the [`on_worker_boot` hook](https://www.rubydoc.info/gems/puma/Puma%2FDSL:on_worker_boot).
|
14
|
+
|
13
15
|
## Installation
|
14
16
|
Into Gemfile from rubygems.org:
|
15
17
|
```ruby
|
@@ -24,7 +26,6 @@ To install beta versions:
|
|
24
26
|
gem install amplitude-experiment --pre
|
25
27
|
```
|
26
28
|
|
27
|
-
|
28
29
|
## Remote Evaluation Quick Start
|
29
30
|
```ruby
|
30
31
|
require 'amplitude-experiment'
|
data/lib/experiment/factory.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
module AmplitudeExperiment
|
3
3
|
@local_instance = {}
|
4
4
|
@remote_instance = {}
|
5
|
-
@default_instance = '$default_instance'
|
6
5
|
|
7
6
|
# Initializes a singleton Client. This method returns a default singleton instance, subsequent calls to
|
8
7
|
# init will return the initial instance regardless of input.
|
@@ -10,10 +9,8 @@ module AmplitudeExperiment
|
|
10
9
|
# @param [String] api_key The environment API Key
|
11
10
|
# @param [Config] config Optional Config.
|
12
11
|
def self.initialize_remote(api_key, config = nil)
|
13
|
-
unless @
|
14
|
-
|
15
|
-
end
|
16
|
-
@local_instance.fetch(@default_instance)
|
12
|
+
@remote_instance.store(api_key, RemoteEvaluationClient.new(api_key, config)) unless @remote_instance.key?(api_key)
|
13
|
+
@remote_instance.fetch(api_key)
|
17
14
|
end
|
18
15
|
|
19
16
|
# Initializes a local evaluation Client. A local evaluation client can evaluate local flags or experiments for a
|
@@ -23,9 +20,7 @@ module AmplitudeExperiment
|
|
23
20
|
# @param [String] api_key The environment API Key
|
24
21
|
# @param [Config] config Optional Config.
|
25
22
|
def self.initialize_local(api_key, config = nil)
|
26
|
-
unless @
|
27
|
-
|
28
|
-
end
|
29
|
-
@remote_instance.fetch(@default_instance)
|
23
|
+
@local_instance.store(api_key, LocalEvaluationClient.new(api_key, config)) unless @local_instance.key?(api_key)
|
24
|
+
@local_instance.fetch(api_key)
|
30
25
|
end
|
31
26
|
end
|
data/lib/experiment/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amplitude-experiment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amplitude
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: psych
|