Class: Contrast::Agent::Protect::InputClassification::CachedResult
- Defined in:
- lib/contrast/agent/protect/rule/input_classification/cached_result.rb
Overview
This Class with store the input classification results for a given user input.
Instance Attribute Summary collapse
- #request_id ⇒ Integer readonly
- #result ⇒ String readonly
Instance Method Summary collapse
-
#empty? ⇒ Boolean
Check if the input classification result is empty.
-
#initialize(result, request_id) ⇒ CachedResult
constructor
Initialize Input Classification Cached Result.
Constructor Details
#initialize(result, request_id) ⇒ CachedResult
Initialize Input Classification Cached Result
22 23 24 25 |
# File 'lib/contrast/agent/protect/rule/input_classification/cached_result.rb', line 22 def initialize result, request_id @result = result.dup if result&.cs__is_a?(Contrast::Agent::Reporting::InputAnalysisResult) @request_id = request_id end |
Instance Attribute Details
#request_id ⇒ Integer (readonly)
16 17 18 |
# File 'lib/contrast/agent/protect/rule/input_classification/cached_result.rb', line 16 def request_id @request_id end |
#result ⇒ String (readonly)
14 15 16 |
# File 'lib/contrast/agent/protect/rule/input_classification/cached_result.rb', line 14 def result @result end |
Instance Method Details
#empty? ⇒ Boolean
Check if the input classification result is empty.
30 31 32 |
# File 'lib/contrast/agent/protect/rule/input_classification/cached_result.rb', line 30 def empty? Contrast::Utils::DuckUtils.empty_duck?(@result) && Contrast::Utils::DuckUtils.empty_duck?(@request_id) end |