Class: Rigor::Analysis::Result
- Inherits:
-
Object
- Object
- Rigor::Analysis::Result
- Defined in:
- lib/rigor/analysis/result.rb
Instance Attribute Summary collapse
-
#diagnostics ⇒ Object
readonly
Returns the value of attribute diagnostics.
Instance Method Summary collapse
- #error_count ⇒ Object
-
#initialize(diagnostics: []) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(diagnostics: []) ⇒ Result
Returns a new instance of Result.
8 9 10 |
# File 'lib/rigor/analysis/result.rb', line 8 def initialize(diagnostics: []) @diagnostics = diagnostics end |
Instance Attribute Details
#diagnostics ⇒ Object (readonly)
Returns the value of attribute diagnostics.
6 7 8 |
# File 'lib/rigor/analysis/result.rb', line 6 def diagnostics @diagnostics end |
Instance Method Details
#error_count ⇒ Object
16 17 18 |
# File 'lib/rigor/analysis/result.rb', line 16 def error_count diagnostics.count(&:error?) end |
#success? ⇒ Boolean
12 13 14 |
# File 'lib/rigor/analysis/result.rb', line 12 def success? diagnostics.none?(&:error?) end |
#to_h ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/rigor/analysis/result.rb', line 20 def to_h { "success" => success?, "error_count" => error_count, "diagnostics" => diagnostics.map(&:to_h) } end |