Class: OKF::Bundle::Validator::Result
- Inherits:
-
Object
- Object
- OKF::Bundle::Validator::Result
- Defined in:
- lib/okf/bundle/validator/result.rb
Overview
The outcome of a ยง9 conformance check (see OKF::Bundle::Validator): hard errors,
soft warnings, and file counts. Conformant iff there are no errors.
Instance Attribute Summary collapse
-
#counts ⇒ Object
readonly
Returns the value of attribute counts.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
- #add_error(path, message) ⇒ Object
- #add_warning(path, message) ⇒ Object
- #count(kind) ⇒ Object
-
#initialize ⇒ Result
constructor
A new instance of Result.
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Result
Returns a new instance of Result.
11 12 13 14 15 |
# File 'lib/okf/bundle/validator/result.rb', line 11 def initialize @errors = [] @warnings = [] @counts = { concepts: 0, indexes: 0, logs: 0 } end |
Instance Attribute Details
#counts ⇒ Object (readonly)
Returns the value of attribute counts.
9 10 11 |
# File 'lib/okf/bundle/validator/result.rb', line 9 def counts @counts end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
9 10 11 |
# File 'lib/okf/bundle/validator/result.rb', line 9 def errors @errors end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
9 10 11 |
# File 'lib/okf/bundle/validator/result.rb', line 9 def warnings @warnings end |
Instance Method Details
#add_error(path, message) ⇒ Object
21 22 23 |
# File 'lib/okf/bundle/validator/result.rb', line 21 def add_error(path, ) errors << { path: path, message: } end |
#add_warning(path, message) ⇒ Object
25 26 27 |
# File 'lib/okf/bundle/validator/result.rb', line 25 def add_warning(path, ) warnings << { path: path, message: } end |
#count(kind) ⇒ Object
29 30 31 |
# File 'lib/okf/bundle/validator/result.rb', line 29 def count(kind) @counts[kind] += 1 if @counts.key?(kind) end |
#valid? ⇒ Boolean
17 18 19 |
# File 'lib/okf/bundle/validator/result.rb', line 17 def valid? errors.empty? end |