View Source GrowthBook.Config (GrowthBook v0.2.0)
A set of helper functions to convert config maps to structs.
This module is used to convert the configuration maps that are retrieved from GrowthBook's API
(or your local cache) to values that can be used directly with the GrowthBook.Context
module.
Link to this section Summary
Types
A map with string keys, as returned when decoding JSON using Jason/Poison
Functions
Converts experiment configuration into an GrowthBook.Experiment
.
Converts feature rule configuration to a list of feature rules.
Converts feature configuration to a map of features.
Convert namespace configuration to a namespace.
Link to this section Types
Specs
A map with string keys, as returned when decoding JSON using Jason/Poison
Link to this section Functions
Specs
experiment_from_config(json_map()) :: GrowthBook.Experiment.t()
Converts experiment configuration into an GrowthBook.Experiment
.
Use this function to take the configuration from GrowthBook and
convert it into a usable GrowthBook.Experiment
struct.
Specs
feature_rules_from_config([json_map()], String.t()) :: [ GrowthBook.FeatureRule.t() ]
Converts feature rule configuration to a list of feature rules.
Use this function to take the configuration retrieved from the /features
API endpoint and
convert it into a usable list of GrowthBook.FeatureRule
structs. This function is used by
features_from_config
.
Specs
features_from_config(json_map()) :: GrowthBook.Context.features()
Converts feature configuration to a map of features.
Use this function to take the configuration retrieved from the /features
API endpoint and
convert it into a usable map of GrowthBook.Feature
structs.
Specs
namespace_from_config(term()) :: GrowthBook.namespace() | nil
Convert namespace configuration to a namespace.
Namespaces are represented by tuples, not lists, in the Elixir SDK, so this function converts a list to the corresponding tuple.