Class: Sbom::ValidationResult
- Inherits:
-
Object
- Object
- Sbom::ValidationResult
- Defined in:
- lib/sbom/validation_result.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(valid:, format: nil, version: nil, errors: []) ⇒ ValidationResult
constructor
A new instance of ValidationResult.
- #invalid? ⇒ Boolean
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(valid:, format: nil, version: nil, errors: []) ⇒ ValidationResult
Returns a new instance of ValidationResult.
7 8 9 10 11 12 |
# File 'lib/sbom/validation_result.rb', line 7 def initialize(valid:, format: nil, version: nil, errors: []) @valid = valid @format = format @version = version @errors = errors end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/sbom/validation_result.rb', line 5 def errors @errors end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
5 6 7 |
# File 'lib/sbom/validation_result.rb', line 5 def format @format end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
5 6 7 |
# File 'lib/sbom/validation_result.rb', line 5 def version @version end |
Instance Method Details
#invalid? ⇒ Boolean
18 19 20 |
# File 'lib/sbom/validation_result.rb', line 18 def invalid? !@valid end |
#to_s ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/sbom/validation_result.rb', line 22 def to_s if valid? "#{format} #{version}" else "Invalid: #{errors.join(', ')}" end end |
#valid? ⇒ Boolean
14 15 16 |
# File 'lib/sbom/validation_result.rb', line 14 def valid? @valid end |