Class: ConfigCat::EvaluationDetails

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, value:, variation_id: nil, fetch_time: nil, user: nil, is_default_value: false, error: nil, matched_targeting_rule: nil, matched_percentage_option: nil) ⇒ EvaluationDetails

Returns a new instance of EvaluationDetails.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/configcat/evaluationdetails.rb', line 6

def initialize(key:, value:, variation_id: nil, fetch_time: nil, user: nil, is_default_value: false, error: nil,
               matched_targeting_rule: nil, matched_percentage_option: nil)
  # Key of the feature flag or setting.
  @key = key

  # Evaluated value of the feature flag or setting.
  @value = value

  # Variation ID of the feature flag or setting (if available).
  @variation_id = variation_id

  # Time of last successful config download.
  @fetch_time = fetch_time

  # The User Object used for the evaluation (if available).
  @user = user

  # Indicates whether the default value passed to the setting evaluation methods like ConfigCatClient.get_value,
  # ConfigCatClient.get_value_details, etc. is used as the result of the evaluation.
  @is_default_value = is_default_value

  # Error message in case evaluation failed.
  @error = error

  # The targeting rule (if any) that matched during the evaluation and was used to return the evaluated value.
  @matched_targeting_rule = matched_targeting_rule

  # The percentage option (if any) that was used to select the evaluated value.
  @matched_percentage_option = matched_percentage_option
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



3
4
5
# File 'lib/configcat/evaluationdetails.rb', line 3

def error
  @error
end

#fetch_timeObject (readonly)

Returns the value of attribute fetch_time.



3
4
5
# File 'lib/configcat/evaluationdetails.rb', line 3

def fetch_time
  @fetch_time
end

#is_default_valueObject (readonly)

Returns the value of attribute is_default_value.



3
4
5
# File 'lib/configcat/evaluationdetails.rb', line 3

def is_default_value
  @is_default_value
end

#keyObject (readonly)

Returns the value of attribute key.



3
4
5
# File 'lib/configcat/evaluationdetails.rb', line 3

def key
  @key
end

#matched_percentage_optionObject (readonly)

Returns the value of attribute matched_percentage_option.



3
4
5
# File 'lib/configcat/evaluationdetails.rb', line 3

def matched_percentage_option
  @matched_percentage_option
end

#matched_targeting_ruleObject (readonly)

Returns the value of attribute matched_targeting_rule.



3
4
5
# File 'lib/configcat/evaluationdetails.rb', line 3

def matched_targeting_rule
  @matched_targeting_rule
end

#userObject (readonly)

Returns the value of attribute user.



3
4
5
# File 'lib/configcat/evaluationdetails.rb', line 3

def user
  @user
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/configcat/evaluationdetails.rb', line 3

def value
  @value
end

#variation_idObject (readonly)

Returns the value of attribute variation_id.



3
4
5
# File 'lib/configcat/evaluationdetails.rb', line 3

def variation_id
  @variation_id
end

Class Method Details

.from_error(key, value, error:, variation_id: nil) ⇒ Object



37
38
39
# File 'lib/configcat/evaluationdetails.rb', line 37

def self.from_error(key, value, error:, variation_id: nil)
  EvaluationDetails.new(key: key, value: value, variation_id: variation_id, is_default_value: true, error: error)
end