Class: Cabriolet::Validator
- Inherits:
-
Object
- Object
- Cabriolet::Validator
- Defined in:
- lib/cabriolet/validator.rb
Overview
Archive validation and integrity checking
Constant Summary collapse
- LEVEL_QUICK =
Validation levels
:quick- LEVEL_STANDARD =
Basic structure validation
:standard- LEVEL_THOROUGH =
Standard validation with checksums
:thorough
Instance Method Summary collapse
-
#initialize(path, level: LEVEL_STANDARD) ⇒ Validator
constructor
Full decompression validation.
-
#validate ⇒ ValidationReport
Validate the archive.
Constructor Details
#initialize(path, level: LEVEL_STANDARD) ⇒ Validator
Full decompression validation
11 12 13 14 15 16 17 |
# File 'lib/cabriolet/validator.rb', line 11 def initialize(path, level: LEVEL_STANDARD) @path = path @level = level @errors = [] @warnings = [] @format = nil end |
Instance Method Details
#validate ⇒ ValidationReport
Validate the archive
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/cabriolet/validator.rb', line 28 def validate detect_format case @level when LEVEL_QUICK validate_quick when LEVEL_STANDARD validate_standard when LEVEL_THOROUGH validate_thorough end ValidationReport.new( valid: @errors.empty?, format: @format, level: @level, errors: @errors, warnings: @warnings, path: @path, ) end |