Sha256: ae61c9b750858ca2dcc6fbebc9edbe4835b3d734990c3f5ec8bcdbd6570d9162
Contents?: true
Size: 1.2 KB
Versions: 18
Compression:
Stored size: 1.2 KB
Contents
# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/agent_lib/interface' module Contrast module AgentLib # This class will hold resulst received form AgentLib structs. class EvalResult # Name of the Protect rule analyzed. # @return [String] attr_accessor :rule_id # Type of the input. # @return [String] attr_accessor :input_type # Score of the input after AgentLib # Analysis # # @return score [Float] attr_accessor :score # Init a new EvalResult, and translate results to usable for # reporting values. # # @param hsh [Hash, nil] return from AgentLib populated struct. 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 # Used in specs. def to_controlled_hash { rule_id: rule_id, input_type: input_type, score: score } end end end end
Version data entries
18 entries across 18 versions & 1 rubygems