Class: Mxrb::Integrity::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/mxrb/integrity/validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Validator

Returns a new instance of Validator.



12
13
14
# File 'lib/mxrb/integrity/validator.rb', line 12

def initialize(path)
  @path = path
end

Instance Method Details

#validateObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/mxrb/integrity/validator.rb', line 16

def validate
  @errors = []
  @warnings = []
  @mpr = IO::MprFile.open(@path, readonly: true)
  validate_tables
  validate_units
  validate_v2_files
  Result.new(errors: @errors, warnings: @warnings)
rescue Error => e
  Result.new(errors: [e.message], warnings: @warnings || [])
ensure
  @mpr&.close
end