Module: Quonfig
- Defined in:
- lib/quonfig/types.rb,
lib/quonfig.rb,
lib/quonfig/error.rb,
lib/quonfig/client.rb,
lib/quonfig/reason.rb,
lib/quonfig/context.rb,
lib/quonfig/datadir.rb,
lib/quonfig/options.rb,
lib/quonfig/quonfig.rb,
lib/quonfig/duration.rb,
lib/quonfig/resolver.rb,
lib/quonfig/evaluator.rb,
lib/quonfig/encryption.rb,
lib/quonfig/evaluation.rb,
lib/quonfig/bound_client.rb,
lib/quonfig/config_store.rb,
lib/quonfig/time_helpers.rb,
lib/quonfig/config_loader.rb,
lib/quonfig/periodic_sync.rb,
lib/quonfig/config_envelope.rb,
lib/quonfig/fixed_size_hash.rb,
lib/quonfig/http_connection.rb,
lib/quonfig/internal_logger.rb,
lib/quonfig/rate_limit_cache.rb,
lib/quonfig/sse_config_client.rb,
lib/quonfig/exponential_backoff.rb,
lib/quonfig/semantic_logger_filter.rb,
lib/quonfig/caching_http_connection.rb,
lib/quonfig/weighted_value_resolver.rb,
lib/quonfig/errors/env_var_parse_error.rb,
lib/quonfig/errors/type_mismatch_error.rb,
lib/quonfig/errors/uninitialized_error.rb,
lib/quonfig/errors/invalid_sdk_key_error.rb,
lib/quonfig/errors/missing_default_error.rb,
lib/quonfig/errors/missing_env_var_error.rb,
lib/quonfig/errors/initialization_timeout_error.rb
Overview
Ruby types mirroring the JSON delivery protocol defined in sdk-node/src/types.ts. Field names are snake_case per Ruby convention; callers parsing JSON fixtures (camelCase) are responsible for the mapping. All Structs use keyword_init so omitted fields default to nil.
Defined Under Namespace
Modules: Datadir, Errors, PeriodicSync, Reason, TimeHelpers
Classes: BoundClient, CachingHttpConnection, Client, ConfigEnvelope, ConfigLoader, ConfigResponse, ConfigStore, Context, Criterion, Duration, Encryption, Environment, Error, EvalResult, Evaluation, Evaluator, ExponentialBackoff, FixedSizeHash, HttpConnection, InternalLogger, Meta, Options, ProvidedData, QuonfigDatadirEnvironments, RateLimitCache, Resolver, Rule, RuleSet, SSEConfigClient, SchemaData, SemanticLoggerFilter, Value, WeightedValue, WeightedValueResolver, WeightedValuesData, WorkspaceConfigDocument, WorkspaceEnvironment
Constant Summary
collapse
- NO_DEFAULT_PROVIDED =
:no_default_provided
- VERSION =
File.read(File.dirname(__FILE__) + '/../VERSION').strip
- LOG =
Quonfig::InternalLogger.new(self)
- @@lock =
Concurrent::ReadWriteLock.new
Class Method Summary
collapse
Class Method Details
.defined?(key) ⇒ Boolean
48
49
50
51
|
# File 'lib/quonfig/quonfig.rb', line 48
def self.defined?(key)
ensure_initialized(key)
@singleton.defined?(key)
end
|
.enabled?(feature_name, jit_context = NO_DEFAULT_PROVIDED) ⇒ Boolean
28
29
30
31
|
# File 'lib/quonfig/quonfig.rb', line 28
def self.enabled?(feature_name, jit_context = NO_DEFAULT_PROVIDED)
ensure_initialized(feature_name)
@singleton.enabled?(feature_name, jit_context)
end
|
.ensure_initialized(key = nil) ⇒ Object
53
54
55
56
57
|
# File 'lib/quonfig/quonfig.rb', line 53
def self.ensure_initialized(key = nil)
if !defined?(@singleton) || @singleton.nil?
raise Quonfig::Errors::UninitializedError.new(key)
end
end
|
.fork ⇒ Object
18
19
20
21
|
# File 'lib/quonfig/quonfig.rb', line 18
def self.fork
ensure_initialized
@@lock.with_write_lock { @singleton = @singleton.fork }
end
|
.get(key, default = NO_DEFAULT_PROVIDED, jit_context = NO_DEFAULT_PROVIDED) ⇒ Object
23
24
25
26
|
# File 'lib/quonfig/quonfig.rb', line 23
def self.get(key, default = NO_DEFAULT_PROVIDED, jit_context = NO_DEFAULT_PROVIDED)
ensure_initialized(key)
@singleton.get(key, default, jit_context)
end
|
.init(options = Quonfig::Options.new) ⇒ Object
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/quonfig/quonfig.rb', line 7
def self.init(options = Quonfig::Options.new)
unless @singleton.nil?
LOG.warn 'Quonfig already initialized.'
return @singleton
end
@@lock.with_write_lock do
@singleton = Quonfig::Client.new(options)
end
end
|
.instance ⇒ Object
38
39
40
41
|
# File 'lib/quonfig/quonfig.rb', line 38
def self.instance
ensure_initialized
@singleton
end
|
.semantic_logger_filter(config_key:) ⇒ Object
43
44
45
46
|
# File 'lib/quonfig/quonfig.rb', line 43
def self.semantic_logger_filter(config_key:)
ensure_initialized
@singleton.semantic_logger_filter(config_key: config_key)
end
|
.with_context(properties, &block) ⇒ Object
33
34
35
36
|
# File 'lib/quonfig/quonfig.rb', line 33
def self.with_context(properties, &block)
ensure_initialized
@singleton.with_context(properties, &block)
end
|