Class: CC::Config::Validation::EngineValidator

Inherits:
Object
  • Object
show all
Includes:
HashValidations
Defined in:
lib/cc/config/validation/engine_validator.rb

Constant Summary collapse

RECOGNIZED_KEYS =
%w[
  enabled
  channel
  checks
  config
  exclude_fingerprints
  exclude_patterns
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashValidations

#key_type_error_message, #validate_hash_data, #validate_key_type, #warn_unrecognized_keys

Constructor Details

#initialize(data, legacy: false) ⇒ EngineValidator

Returns a new instance of EngineValidator.



18
19
20
21
22
23
24
25
26
# File 'lib/cc/config/validation/engine_validator.rb', line 18

def initialize(data, legacy: false)
  @data = data
  @legacy = legacy

  @errors = []
  @warnings = []

  validate
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



16
17
18
# File 'lib/cc/config/validation/engine_validator.rb', line 16

def errors
  @errors
end

#warningsObject (readonly)

Returns the value of attribute warnings.



16
17
18
# File 'lib/cc/config/validation/engine_validator.rb', line 16

def warnings
  @warnings
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/cc/config/validation/engine_validator.rb', line 28

def valid?
  errors.none?
end