View Source GrowthBook.Config (GrowthBook v0.3.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

json_map() :: %{required(String.t()) => term()}

A map with string keys, as returned when decoding JSON using Jason/Poison

Link to this section Functions

Link to this function

experiment_from_config(experiment_config)

View Source

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.

Link to this function

feature_rules_from_config(feature_rules, feature_key)

View Source

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.

Link to this function

features_from_config(arg1)

View Source

Specs

features_from_config(json_map()) :: %{
  required(GrowthBook.feature_key()) => GrowthBook.Feature.t()
}

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.

Link to this function

namespace_from_config(arg1)

View Source

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.