Class: Statsig::ConfigResult
- Inherits:
-
Object
- Object
- Statsig::ConfigResult
- Extended by:
- T::Sig
- Defined in:
- lib/config_result.rb
Instance Attribute Summary collapse
-
#config_delegate ⇒ Object
Returns the value of attribute config_delegate.
-
#evaluation_details ⇒ Object
Returns the value of attribute evaluation_details.
-
#explicit_parameters ⇒ Object
Returns the value of attribute explicit_parameters.
-
#gate_value ⇒ Object
Returns the value of attribute gate_value.
-
#group_name ⇒ Object
Returns the value of attribute group_name.
-
#id_type ⇒ Object
Returns the value of attribute id_type.
-
#is_experiment_group ⇒ Object
Returns the value of attribute is_experiment_group.
-
#json_value ⇒ Object
Returns the value of attribute json_value.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rule_id ⇒ Object
Returns the value of attribute rule_id.
-
#secondary_exposures ⇒ Object
Returns the value of attribute secondary_exposures.
-
#target_app_ids ⇒ Object
Returns the value of attribute target_app_ids.
-
#undelegated_sec_exps ⇒ Object
Returns the value of attribute undelegated_sec_exps.
Class Method Summary collapse
- .from_hash(config_name, hash) ⇒ Object
- .from_user_persisted_values(config_name, user_persisted_values) ⇒ Object
Instance Method Summary collapse
-
#initialize(name, gate_value = false, json_value = {}, rule_id = '', secondary_exposures = [], config_delegate = nil, explicit_parameters = [], is_experiment_group: false, evaluation_details: nil, group_name: nil, id_type: '', target_app_ids: nil) ⇒ ConfigResult
constructor
A new instance of ConfigResult.
- #to_hash ⇒ Object
Constructor Details
#initialize(name, gate_value = false, json_value = {}, rule_id = '', secondary_exposures = [], config_delegate = nil, explicit_parameters = [], is_experiment_group: false, evaluation_details: nil, group_name: nil, id_type: '', target_app_ids: nil) ⇒ ConfigResult
Returns a new instance of ConfigResult.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/config_result.rb', line 23 def initialize( name, gate_value = false, json_value = {}, rule_id = '', secondary_exposures = [], config_delegate = nil, explicit_parameters = [], is_experiment_group: false, evaluation_details: nil, group_name: nil, id_type: '', target_app_ids: nil) @name = name @gate_value = gate_value @json_value = json_value @rule_id = rule_id @secondary_exposures = secondary_exposures.is_a?(Array) ? secondary_exposures : [] @undelegated_sec_exps = @secondary_exposures @config_delegate = config_delegate @explicit_parameters = explicit_parameters @is_experiment_group = is_experiment_group @evaluation_details = evaluation_details @group_name = group_name @id_type = id_type @target_app_ids = target_app_ids end |
Instance Attribute Details
#config_delegate ⇒ Object
Returns the value of attribute config_delegate.
15 16 17 |
# File 'lib/config_result.rb', line 15 def config_delegate @config_delegate end |
#evaluation_details ⇒ Object
Returns the value of attribute evaluation_details.
18 19 20 |
# File 'lib/config_result.rb', line 18 def evaluation_details @evaluation_details end |
#explicit_parameters ⇒ Object
Returns the value of attribute explicit_parameters.
16 17 18 |
# File 'lib/config_result.rb', line 16 def explicit_parameters @explicit_parameters end |
#gate_value ⇒ Object
Returns the value of attribute gate_value.
10 11 12 |
# File 'lib/config_result.rb', line 10 def gate_value @gate_value end |
#group_name ⇒ Object
Returns the value of attribute group_name.
19 20 21 |
# File 'lib/config_result.rb', line 19 def group_name @group_name end |
#id_type ⇒ Object
Returns the value of attribute id_type.
20 21 22 |
# File 'lib/config_result.rb', line 20 def id_type @id_type end |
#is_experiment_group ⇒ Object
Returns the value of attribute is_experiment_group.
17 18 19 |
# File 'lib/config_result.rb', line 17 def is_experiment_group @is_experiment_group end |
#json_value ⇒ Object
Returns the value of attribute json_value.
11 12 13 |
# File 'lib/config_result.rb', line 11 def json_value @json_value end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/config_result.rb', line 9 def name @name end |
#rule_id ⇒ Object
Returns the value of attribute rule_id.
12 13 14 |
# File 'lib/config_result.rb', line 12 def rule_id @rule_id end |
#secondary_exposures ⇒ Object
Returns the value of attribute secondary_exposures.
13 14 15 |
# File 'lib/config_result.rb', line 13 def secondary_exposures @secondary_exposures end |
#target_app_ids ⇒ Object
Returns the value of attribute target_app_ids.
21 22 23 |
# File 'lib/config_result.rb', line 21 def target_app_ids @target_app_ids end |
#undelegated_sec_exps ⇒ Object
Returns the value of attribute undelegated_sec_exps.
14 15 16 |
# File 'lib/config_result.rb', line 14 def undelegated_sec_exps @undelegated_sec_exps end |
Class Method Details
.from_hash(config_name, hash) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/config_result.rb', line 60 def self.from_hash(config_name, hash) new( config_name, hash['gate_value'], hash['json_value'], hash['rule_id'], hash['secondary_exposures'], evaluation_details: EvaluationDetails.persisted(hash['config_sync_time'], hash['init_time']), group_name: hash['group_name'], id_type: hash['id_type'], target_app_ids: hash['target_app_ids'] ) end |
.from_user_persisted_values(config_name, user_persisted_values) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/config_result.rb', line 52 def self.from_user_persisted_values(config_name, user_persisted_values) sticky_values = user_persisted_values[config_name] return nil if sticky_values.nil? from_hash(config_name, sticky_values) end |
Instance Method Details
#to_hash ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/config_result.rb', line 75 def to_hash { json_value: @json_value, gate_value: @gate_value, rule_id: @rule_id, secondary_exposures: @secondary_exposures, config_sync_time: @evaluation_details.config_sync_time, init_time: @init_time, group_name: @group_name, id_type: @id_type, target_app_ids: @target_app_ids } end |