Class: Statsig::ConfigResult

Inherits:
Object
  • Object
show all
Defined in:
lib/config_result.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, gate_value: false, json_value: nil, rule_id: nil, secondary_exposures: [], config_delegate: nil, explicit_parameters: nil, is_experiment_group: false, evaluation_details: nil, group_name: nil, id_type: nil, target_app_ids: nil, disable_evaluation_details: false, disable_exposures: false, config_version: nil) ⇒ ConfigResult

Returns a new instance of ConfigResult.



21
22
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
50
51
52
53
54
# File 'lib/config_result.rb', line 21

def initialize(
  name:,
  gate_value: false,
  json_value: nil,
  rule_id: nil,
  secondary_exposures: [],
  config_delegate: nil,
  explicit_parameters: nil,
  is_experiment_group: false,
  evaluation_details: nil,
  group_name: nil,
  id_type: nil,
  target_app_ids: nil,
  disable_evaluation_details: false,
  disable_exposures: false,
  config_version: nil
)
  @name = name
  @gate_value = gate_value
  @json_value = json_value
  @rule_id = rule_id
  @secondary_exposures = 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
  @disable_evaluation_details = disable_evaluation_details
  @disable_exposures = disable_exposures
  @config_version = config_version
end

Instance Attribute Details

#config_delegateObject

Returns the value of attribute config_delegate.



10
11
12
# File 'lib/config_result.rb', line 10

def config_delegate
  @config_delegate
end

#config_versionObject

Returns the value of attribute config_version.



19
20
21
# File 'lib/config_result.rb', line 19

def config_version
  @config_version
end

#disable_evaluation_detailsObject

Returns the value of attribute disable_evaluation_details.



17
18
19
# File 'lib/config_result.rb', line 17

def disable_evaluation_details
  @disable_evaluation_details
end

#disable_exposuresObject

Returns the value of attribute disable_exposures.



18
19
20
# File 'lib/config_result.rb', line 18

def disable_exposures
  @disable_exposures
end

#evaluation_detailsObject

Returns the value of attribute evaluation_details.



13
14
15
# File 'lib/config_result.rb', line 13

def evaluation_details
  @evaluation_details
end

#explicit_parametersObject

Returns the value of attribute explicit_parameters.



11
12
13
# File 'lib/config_result.rb', line 11

def explicit_parameters
  @explicit_parameters
end

#gate_valueObject

Returns the value of attribute gate_value.



5
6
7
# File 'lib/config_result.rb', line 5

def gate_value
  @gate_value
end

#group_nameObject

Returns the value of attribute group_name.



14
15
16
# File 'lib/config_result.rb', line 14

def group_name
  @group_name
end

#id_typeObject

Returns the value of attribute id_type.



15
16
17
# File 'lib/config_result.rb', line 15

def id_type
  @id_type
end

#is_experiment_groupObject

Returns the value of attribute is_experiment_group.



12
13
14
# File 'lib/config_result.rb', line 12

def is_experiment_group
  @is_experiment_group
end

#json_valueObject

Returns the value of attribute json_value.



6
7
8
# File 'lib/config_result.rb', line 6

def json_value
  @json_value
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/config_result.rb', line 4

def name
  @name
end

#rule_idObject

Returns the value of attribute rule_id.



7
8
9
# File 'lib/config_result.rb', line 7

def rule_id
  @rule_id
end

#secondary_exposuresObject

Returns the value of attribute secondary_exposures.



8
9
10
# File 'lib/config_result.rb', line 8

def secondary_exposures
  @secondary_exposures
end

#target_app_idsObject

Returns the value of attribute target_app_ids.



16
17
18
# File 'lib/config_result.rb', line 16

def target_app_ids
  @target_app_ids
end

#undelegated_sec_expsObject

Returns the value of attribute undelegated_sec_exps.



9
10
11
# File 'lib/config_result.rb', line 9

def undelegated_sec_exps
  @undelegated_sec_exps
end

Class Method Details

.from_user_persisted_values(config_name, user_persisted_values) ⇒ Object



56
57
58
59
60
61
# File 'lib/config_result.rb', line 56

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_hashObject



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/config_result.rb', line 63

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