Class: Contrast::Components::AssessRules::Interface

Inherits:
Object
  • Object
show all
Includes:
ComponentBase, Contrast::Config::BaseConfiguration
Defined in:
lib/contrast/components/assess_rules.rb

Overview

:nodoc:

Constant Summary collapse

SPEC_KEY =
:disabled_rules.cs__freeze
CANON_NAME =
'assess.rules'

Constants included from ComponentBase

ComponentBase::ENABLE

Constants included from Contrast::Config::Diagnostics::Tools

Contrast::Config::Diagnostics::Tools::CHECK

Constants included from Contrast::Config::Diagnostics::SingletonTools

Contrast::Config::Diagnostics::SingletonTools::API_CREDENTIALS, Contrast::Config::Diagnostics::SingletonTools::CONTRAST_MARK

Constants included from Contrast::Config::BaseConfiguration

Contrast::Config::BaseConfiguration::AT_UNDERSCORE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ComponentBase

#config_values, #false?, #file_exists?, #stringify_array, #true?, #valid_cert?

Methods included from Contrast::Config::Diagnostics::Tools

#add_effective_config_values, #add_single_effective_value

Methods included from Contrast::Config::Diagnostics::SingletonTools

#flatten_settings, #to_config_values, #update_config, #value_to_s

Methods included from Contrast::Config::BaseConfiguration

#to_contrast_hash

Constructor Details

#initialize(hsh = {}) ⇒ Interface

Returns a new instance of Interface.



25
26
27
28
29
30
31
# File 'lib/contrast/components/assess_rules.rb', line 25

def initialize hsh = {}
  @canon_name = CANON_NAME
  @disabled_rules = []
  return unless hsh

  @disabled_rules = cast_disabled_rules(hsh)
end

Instance Attribute Details

#canon_nameString (readonly)

Returns:



23
24
25
# File 'lib/contrast/components/assess_rules.rb', line 23

def canon_name
  @canon_name
end

#disabled_rulesArray?

Returns list of disabled assess rules.

Returns:

  • (Array, nil)

    list of disabled assess rules



21
22
23
# File 'lib/contrast/components/assess_rules.rb', line 21

def disabled_rules
  @disabled_rules
end

Instance Method Details

#to_effective_config(effective_config) ⇒ Object

Converts current configuration to effective config values class and appends them to EffectiveConfig class.

Parameters:



37
38
39
# File 'lib/contrast/components/assess_rules.rb', line 37

def to_effective_config effective_config
  add_single_effective_value(effective_config, SPEC_KEY.to_s, disabled_rules || [], canon_name)
end