Class: Contrast::Agent::Reporting::Settings::ExclusionBase
- Defined in:
- lib/contrast/agent/reporting/settings/exclusion_base.rb
Overview
Base class to represent common exclusions fields.
Direct Known Subclasses
Constant Summary collapse
- BASE_ATTRIBUTES =
%i[name modes assess_rules protect_rules urls match_strategy].cs__freeze
- STRATEGIES =
%w[ALL ONLY].cs__freeze
Instance Attribute Summary collapse
-
#modes ⇒ Object
Returns the value of attribute modes.
-
#name ⇒ Object
Base attribute for exclusion name.
-
#urls ⇒ Object
Returns the value of attribute urls.
Instance Method Summary collapse
-
#assess ⇒ Boolean
Does this exclusion apply to Assess or not.
-
#assess_rules ⇒ Array<String>
Array of all excluded assess rules.
-
#assess_rules=(new_rules) ⇒ Array<String>
Setter for assess rules array.
-
#initialize ⇒ ExclusionBase
constructor
A new instance of ExclusionBase.
- #match_strategy ⇒ Object
- #match_strategy=(new_strategy) ⇒ Object
-
#protect ⇒ Boolean
Does this exclusion apply to Protect or not.
-
#protect_rules ⇒ Array<String>
Array of all excluded protect rules.
-
#protect_rules=(new_rules) ⇒ Array<String>
Setter for protect rules array.
- #to_controlled_hash ⇒ Object
Constructor Details
#initialize ⇒ ExclusionBase
Returns a new instance of ExclusionBase.
25 26 27 28 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 25 def initialize @modes = [] @urls = [] end |
Instance Attribute Details
#modes ⇒ Object
Returns the value of attribute modes.
21 22 23 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 21 def modes @modes end |
#name ⇒ Object
Base attribute for exclusion name. For ng response it corresponds only for the name of the exclusion, in the new server settings endpoint it is used to store the name of the input to be excluded.
19 20 21 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 19 def name @name end |
#urls ⇒ Object
Returns the value of attribute urls.
23 24 25 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 23 def urls @urls end |
Instance Method Details
#assess ⇒ Boolean
Returns does this exclusion apply to Assess or not.
42 43 44 45 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 42 def assess @_assess = modes&.include?('assess') if @_assess.nil? @_assess end |
#assess_rules ⇒ Array<String>
Array of all excluded assess rules.
71 72 73 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 71 def assess_rules @_assess_rules ||= assessment_rules end |
#assess_rules=(new_rules) ⇒ Array<String>
Setter for assess rules array.
79 80 81 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 79 def assess_rules= new_rules @_assess_rules = new_rules if new_rules.cs__is_a?(Array) end |
#match_strategy ⇒ Object
31 32 33 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 31 def match_strategy @_match_strategy ||= Contrast::Utils::ObjectShare::EMPTY_STRING end |
#match_strategy=(new_strategy) ⇒ Object
37 38 39 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 37 def match_strategy= new_strategy @_match_strategy = new_strategy if STRATEGIES.include?(new_strategy) end |
#protect ⇒ Boolean
Returns does this exclusion apply to Protect or not.
48 49 50 51 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 48 def protect @_protect = modes&.include?('defend') if @_protect.nil? @_protect end |
#protect_rules ⇒ Array<String>
Array of all excluded protect rules.
56 57 58 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 56 def protect_rules @_protect_rules ||= rules end |
#protect_rules=(new_rules) ⇒ Array<String>
Setter for protect rules array.
64 65 66 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 64 def protect_rules= new_rules @_protect_rules = new_rules if new_rules.cs__is_a?(Array) end |
#to_controlled_hash ⇒ Object
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/contrast/agent/reporting/settings/exclusion_base.rb', line 83 def to_controlled_hash { name: name, # rubocop:disable Security/Module/Name modes: modes, urls: urls, assess_rules: assess_rules, protect_rules: protect_rules, match_strategy: match_strategy } end |