Class: Dragnet::Validator
- Inherits:
-
Object
- Object
- Dragnet::Validator
- Defined in:
- lib/dragnet/validator.rb
Overview
Validates a set of Manual Test Record files. That means, checking that they can be read, that they are valid YAML files, that they have the expected keys and that these keys have sensible values.
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#valid_files ⇒ Object
readonly
Returns the value of attribute valid_files.
Instance Method Summary collapse
-
#initialize(files:, path:, logger:) ⇒ Validator
constructor
Creates a new instance of the class.
-
#validate ⇒ Array<Dragnet::TestRecord>
Validates the given files.
Constructor Details
#initialize(files:, path:, logger:) ⇒ Validator
Creates a new instance of the class.
20 21 22 23 24 |
# File 'lib/dragnet/validator.rb', line 20 def initialize(files:, path:, logger:) @files = files @path = path @logger = logger end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
14 15 16 |
# File 'lib/dragnet/validator.rb', line 14 def errors @errors end |
#files ⇒ Object (readonly)
Returns the value of attribute files.
14 15 16 |
# File 'lib/dragnet/validator.rb', line 14 def files @files end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
14 15 16 |
# File 'lib/dragnet/validator.rb', line 14 def logger @logger end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
14 15 16 |
# File 'lib/dragnet/validator.rb', line 14 def path @path end |
#valid_files ⇒ Object (readonly)
Returns the value of attribute valid_files.
14 15 16 |
# File 'lib/dragnet/validator.rb', line 14 def valid_files @valid_files end |
Instance Method Details
#validate ⇒ Array<Dragnet::TestRecord>
Validates the given files.
30 31 32 33 34 35 |
# File 'lib/dragnet/validator.rb', line 30 def validate logger.info('Validating MTR Files...') @errors = [] @valid_files = files.map { |file| validate_file(file) }.compact end |