Module: Growthbook
- Defined in:
- lib/growthbook.rb,
lib/growthbook/util.rb,
lib/growthbook/context.rb,
lib/growthbook/feature.rb,
lib/growthbook/conditions.rb,
lib/growthbook/feature_rule.rb,
lib/growthbook/feature_result.rb,
lib/growthbook/decryption_util.rb,
lib/growthbook/payload_reducer.rb,
lib/growthbook/inline_experiment.rb,
lib/growthbook/tracking_callback.rb,
lib/growthbook/feature_repository.rb,
lib/growthbook/sticky_bucket_service.rb,
lib/growthbook/feature_usage_callback.rb,
lib/growthbook/inline_experiment_result.rb
Overview
The GrowthBook SDK
Defined Under Namespace
Classes: Conditions, Context, DecryptionUtil, Feature, FeatureRepository, FeatureResult, FeatureRule, FeatureUsageCallback, InMemoryStickyBucketService, InlineExperiment, InlineExperimentResult, PayloadReducer, StickyBucketService, TrackingCallback, Util
Class Method Summary collapse
-
.prune_condition(attributes, condition, saved_groups = {}) ⇒ true, ...
Partially evaluate a targeting condition when only some attributes are known, e.g.
-
.reduce_payload(payload, attributes: {}, include: {}, exclude: {}, prerequisites: 'keep') ⇒ Hash
Shrink a features payload for a user whose attributes are only partly known, e.g.
Class Method Details
.prune_condition(attributes, condition, saved_groups = {}) ⇒ true, ...
Partially evaluate a targeting condition when only some attributes are known,
e.g. on a server. Attributes missing from attributes are unknown.
13 14 15 16 17 18 19 |
# File 'lib/growthbook.rb', line 13 def self.prune_condition(attributes, condition, saved_groups = {}) Growthbook::Conditions.prune_condition( Growthbook::Conditions.parse_condition(attributes || {}), Growthbook::Conditions.parse_condition(condition), saved_groups || {} ) end |
.reduce_payload(payload, attributes: {}, include: {}, exclude: {}, prerequisites: 'keep') ⇒ Hash
Shrink a features payload for a user whose attributes are only partly known, e.g. on a server that bootstraps a client-side SDK. The result evaluates the same as the full payload for anyone who agrees with the known attributes.
34 35 36 37 38 39 40 41 42 |
# File 'lib/growthbook.rb', line 34 def self.reduce_payload(payload, attributes: {}, include: {}, exclude: {}, prerequisites: 'keep') Growthbook::PayloadReducer.new( Growthbook::Conditions.parse_condition(payload), attributes: Growthbook::Conditions.parse_condition(attributes || {}), include: payload_filters(include), exclude: payload_filters(exclude), prerequisites: prerequisites ).reduce end |