Class: Contrast::Agent::Protect::Rule::InputClassification::EncodingRates
- Defined in:
- lib/contrast/agent/protect/rule/input_classification/encoding_rates.rb
Overview
This class will hold match information when input classification is being saved in LRU cache.
Constant Summary
Constants inherited from Rates
Rates::FIELD_NAME, Rates::TEST_NAME
Instance Attribute Summary collapse
- #base64_matches ⇒ Integer readonly
- #base64_mismatches ⇒ Integer readonly
Attributes inherited from Rates
Instance Method Summary collapse
-
#increase_match_base64 ⇒ Object
Increase the match count for the given rule_id and input.
- #increase_mismatch_base64 ⇒ Object
-
#initialize(input_type) ⇒ EncodingRates
constructor
A new instance of EncodingRates.
-
#to_fields ⇒ Hash
Returns Agent Telemetry reportable fields.
Methods inherited from Rates
Constructor Details
#initialize(input_type) ⇒ EncodingRates
Returns a new instance of EncodingRates.
18 19 20 21 22 |
# File 'lib/contrast/agent/protect/rule/input_classification/encoding_rates.rb', line 18 def initialize input_type super(nil, input_type) @base64_matches = 0 @base64_mismatches = 0 end |
Instance Attribute Details
#base64_matches ⇒ Integer (readonly)
14 15 16 |
# File 'lib/contrast/agent/protect/rule/input_classification/encoding_rates.rb', line 14 def base64_matches @base64_matches end |
#base64_mismatches ⇒ Integer (readonly)
16 17 18 |
# File 'lib/contrast/agent/protect/rule/input_classification/encoding_rates.rb', line 16 def base64_mismatches @base64_mismatches end |
Instance Method Details
#increase_match_base64 ⇒ Object
Increase the match count for the given rule_id and input.
25 26 27 |
# File 'lib/contrast/agent/protect/rule/input_classification/encoding_rates.rb', line 25 def increase_match_base64 @base64_matches += 1 end |
#increase_mismatch_base64 ⇒ Object
29 30 31 |
# File 'lib/contrast/agent/protect/rule/input_classification/encoding_rates.rb', line 29 def increase_mismatch_base64 @base64_mismatches += 1 end |
#to_fields ⇒ Hash
Returns Agent Telemetry reportable fields.
36 37 38 39 40 41 |
# File 'lib/contrast/agent/protect/rule/input_classification/encoding_rates.rb', line 36 def to_fields { "#{ to_field_title }.input_base64_matches" => base64_matches, "#{ to_field_title }.input_base64_mismatches" => base64_mismatches } end |