Class: Contrast::Agent::Protect::Rule::InputClassification::Rates

Inherits:
Object
  • Object
show all
Defined in:
lib/contrast/agent/protect/rule/input_classification/rates.rb

Overview

This class will hold match information when input classification is being saved in LRU cache.

Direct Known Subclasses

EncodingRates, MatchRates

Constant Summary collapse

FIELD_NAME =

Titles:

'ia'
TEST_NAME =
'_t'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rule_id, input_type) ⇒ Rates

Returns a new instance of Rates.



23
24
25
26
# File 'lib/contrast/agent/protect/rule/input_classification/rates.rb', line 23

def initialize rule_id, input_type
  @rule_id = rule_id if rule_id
  @input_type = input_type if Contrast::Agent::Reporting::InputType.to_a.include?(input_type)
end

Instance Attribute Details

#input_typeSymbol? (readonly)

Returns:

  • (Symbol, nil)


21
22
23
# File 'lib/contrast/agent/protect/rule/input_classification/rates.rb', line 21

def input_type
  @input_type
end

#rule_idString (readonly)

Returns:



19
20
21
# File 'lib/contrast/agent/protect/rule/input_classification/rates.rb', line 19

def rule_id
  @rule_id
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/contrast/agent/protect/rule/input_classification/rates.rb', line 28

def empty?
  Contrast::Utils::DuckUtils.empty_duck?(@input_type)
end

#to_fieldsHash

Override this method to return the required Agent Telemetry fields.

Returns:



34
35
36
# File 'lib/contrast/agent/protect/rule/input_classification/rates.rb', line 34

def to_fields
  {}
end