Class: Lutaml::Xsd::FileValidationResult
- Inherits:
-
Object
- Object
- Lutaml::Xsd::FileValidationResult
- Defined in:
- lib/lutaml/xsd/file_validation_result.rb
Overview
Value object representing the validation result for a single file
Instance Attribute Summary collapse
-
#detected_version ⇒ Object
readonly
Returns the value of attribute detected_version.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
-
#failure? ⇒ Boolean
True if the file failed validation.
-
#initialize(file:, valid:, error: nil, detected_version: nil) ⇒ FileValidationResult
constructor
A new instance of FileValidationResult.
-
#success? ⇒ Boolean
True if the file passed validation.
-
#to_h ⇒ Hash
Convert to hash for backward compatibility.
-
#to_s ⇒ String
Human-readable string representation.
Constructor Details
#initialize(file:, valid:, error: nil, detected_version: nil) ⇒ FileValidationResult
Returns a new instance of FileValidationResult.
13 14 15 16 17 18 |
# File 'lib/lutaml/xsd/file_validation_result.rb', line 13 def initialize(file:, valid:, error: nil, detected_version: nil) @file = file @valid = valid @error = error @detected_version = detected_version end |
Instance Attribute Details
#detected_version ⇒ Object (readonly)
Returns the value of attribute detected_version.
7 8 9 |
# File 'lib/lutaml/xsd/file_validation_result.rb', line 7 def detected_version @detected_version end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
7 8 9 |
# File 'lib/lutaml/xsd/file_validation_result.rb', line 7 def error @error end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/lutaml/xsd/file_validation_result.rb', line 7 def file @file end |
Instance Method Details
#failure? ⇒ Boolean
Returns true if the file failed validation.
26 27 28 |
# File 'lib/lutaml/xsd/file_validation_result.rb', line 26 def failure? !success? end |
#success? ⇒ Boolean
Returns true if the file passed validation.
21 22 23 |
# File 'lib/lutaml/xsd/file_validation_result.rb', line 21 def success? @valid end |
#to_h ⇒ Hash
Convert to hash for backward compatibility
32 33 34 35 36 37 38 39 |
# File 'lib/lutaml/xsd/file_validation_result.rb', line 32 def to_h { file: file, valid: success?, error: error, detected_version: detected_version, }.compact end |
#to_s ⇒ String
Returns Human-readable string representation.
42 43 44 45 46 47 48 |
# File 'lib/lutaml/xsd/file_validation_result.rb', line 42 def to_s if success? "#{file}: VALID" else "#{file}: INVALID - #{error}" end end |