Class: Toggly::EvaluationResult

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

Overview

Result of a feature evaluation with details

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(feature_key:, enabled:, reason:) ⇒ EvaluationResult

Returns a new instance of EvaluationResult.



161
162
163
164
165
166
167
# File 'lib/toggly/evaluation_engine.rb', line 161

def initialize(feature_key:, enabled:, reason:)
  @feature_key = feature_key
  @enabled = enabled
  @reason = reason
  @matched_rule = nil
  @matched_rule_index = nil
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



159
160
161
# File 'lib/toggly/evaluation_engine.rb', line 159

def enabled
  @enabled
end

#feature_keyObject

Returns the value of attribute feature_key.



159
160
161
# File 'lib/toggly/evaluation_engine.rb', line 159

def feature_key
  @feature_key
end

#matched_ruleObject

Returns the value of attribute matched_rule.



159
160
161
# File 'lib/toggly/evaluation_engine.rb', line 159

def matched_rule
  @matched_rule
end

#matched_rule_indexObject

Returns the value of attribute matched_rule_index.



159
160
161
# File 'lib/toggly/evaluation_engine.rb', line 159

def matched_rule_index
  @matched_rule_index
end

#reasonObject

Returns the value of attribute reason.



159
160
161
# File 'lib/toggly/evaluation_engine.rb', line 159

def reason
  @reason
end

Instance Method Details

#to_hObject



169
170
171
172
173
174
175
176
177
# File 'lib/toggly/evaluation_engine.rb', line 169

def to_h
  {
    feature_key: @feature_key,
    enabled: @enabled,
    reason: @reason,
    matched_rule: @matched_rule,
    matched_rule_index: @matched_rule_index
  }
end