Class: Contrast::AgentLib::EvalResult
- Defined in:
- lib/contrast/agent_lib/return_types/eval_result.rb
Overview
This class will hold resulst received form AgentLib structs.
Instance Attribute Summary collapse
-
#input_type ⇒ String
Type of the input.
-
#rule_id ⇒ String
Name of the Protect rule analyzed.
-
#score ⇒ Object
Score of the input after AgentLib Analysis.
Instance Method Summary collapse
-
#initialize(hsh) ⇒ EvalResult
constructor
Init a new EvalResult, and translate results to usable for reporting values.
-
#to_controlled_hash ⇒ Object
Used in specs.
Constructor Details
#initialize(hsh) ⇒ EvalResult
Init a new EvalResult, and translate results to usable for reporting values.
26 27 28 29 30 31 32 |
# File 'lib/contrast/agent_lib/return_types/eval_result.rb', line 26 def initialize hsh return unless hsh&.cs__is_a?(Hash) @rule_id = Contrast::AGENT_LIB.rule_set.key(hsh[:rule_id]) @input_type = Contrast::AGENT_LIB.input_set.key(hsh[:input_type]) @score = hsh[:score] end |
Instance Attribute Details
#input_type ⇒ String
Type of the input.
15 16 17 |
# File 'lib/contrast/agent_lib/return_types/eval_result.rb', line 15 def input_type @input_type end |
#rule_id ⇒ String
Name of the Protect rule analyzed.
12 13 14 |
# File 'lib/contrast/agent_lib/return_types/eval_result.rb', line 12 def rule_id @rule_id end |
#score ⇒ Object
Score of the input after AgentLib Analysis
20 21 22 |
# File 'lib/contrast/agent_lib/return_types/eval_result.rb', line 20 def score @score end |
Instance Method Details
#to_controlled_hash ⇒ Object
Used in specs.
35 36 37 38 39 40 41 |
# File 'lib/contrast/agent_lib/return_types/eval_result.rb', line 35 def to_controlled_hash { rule_id: rule_id, input_type: input_type, score: score } end |