Module: AmplitudeExperiment
- Defined in:
- lib/experiment/factory.rb,
lib/experiment/user.rb,
lib/experiment/cookie.rb,
lib/experiment/variant.rb,
lib/experiment/version.rb,
lib/amplitude-experiment.rb,
lib/experiment/local/cache.rb,
lib/experiment/local/client.rb,
lib/experiment/local/config.rb,
lib/experiment/local/poller.rb,
lib/experiment/local/fetcher.rb,
lib/experiment/remote/client.rb,
lib/experiment/remote/config.rb,
lib/experiment/persistent_http_client.rb
Overview
Amplitude Experiment Module
Defined Under Namespace
Classes: AmplitudeCookie, FlagConfigPoller, InMemoryFlagConfigCache, LocalEvaluationClient, LocalEvaluationConfig, LocalEvaluationFetcher, PersistentHttpClient, RemoteEvaluationClient, RemoteEvaluationConfig, User, Variant
Constant Summary collapse
- VERSION =
'0.1.0'.freeze
Class Method Summary collapse
-
.initialize_local(api_key, config = nil) ⇒ Object
Initializes a local evaluation Client.
-
.initialize_remote(api_key, config = nil) ⇒ Object
Initializes a singleton Client.
Class Method Details
.initialize_local(api_key, config = nil) ⇒ Object
Initializes a local evaluation Client. A local evaluation client can evaluate local flags or experiments for a user without requiring a remote call to the amplitude evaluation server. In order to best leverage local evaluation, all flags, and experiments being evaluated server side should be configured as local.
25 26 27 28 29 30 |
# File 'lib/experiment/factory.rb', line 25 def self.initialize_local(api_key, config = nil) unless @remote_instance.key?(@default_instance) @remote_instance.store(@default_instance, LocalEvaluationClient.new(api_key, config)) end @remote_instance.fetch(@default_instance) end |
.initialize_remote(api_key, config = nil) ⇒ Object
Initializes a singleton Client. This method returns a default singleton instance, subsequent calls to
init will return the initial instance regardless of input.
12 13 14 15 16 17 |
# File 'lib/experiment/factory.rb', line 12 def self.initialize_remote(api_key, config = nil) unless @local_instance.key?(@default_instance) @local_instance.store(@default_instance, RemoteEvaluationClient.new(api_key, config)) end @local_instance.fetch(@default_instance) end |