Class: Mxrb::Integrity::Validator
- Inherits:
-
Object
- Object
- Mxrb::Integrity::Validator
- Defined in:
- lib/mxrb/integrity/validator.rb
Instance Method Summary collapse
-
#initialize(path) ⇒ Validator
constructor
A new instance of Validator.
- #validate ⇒ Object
Constructor Details
Instance Method Details
#validate ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/mxrb/integrity/validator.rb', line 17 def validate Progress.with("Validating #{File.basename(@path)}") do |progress| @progress = progress @errors = [] @warnings = [] @mpr = IO::MprFile.open(@path, readonly: true) validate_tables progress.advance(detail: "MPR tables") validate_units validate_v2_files progress.advance(detail: "v2 contents") Result.new(errors: @errors, warnings: @warnings) end rescue Error => e Result.new(errors: [e.], warnings: @warnings || []) ensure @progress = Progress::NullTask.instance @mpr&.close end |