Class: Rigor::Analysis::Result
- Inherits:
-
Object
- Object
- Rigor::Analysis::Result
- Defined in:
- lib/rigor/analysis/result.rb,
sig/rigor.rbs
Instance Attribute Summary collapse
-
#diagnostics ⇒ Array[Diagnostic]
readonly
Returns the value of attribute diagnostics.
-
#stats ⇒ RunStats?
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
- #error_count ⇒ Integer
-
#initialize(diagnostics: [], stats: nil) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
- #to_h ⇒ Hash[String, untyped]
Constructor Details
#initialize(diagnostics: [], stats: nil) ⇒ Result
Returns a new instance of Result.
11 12 13 14 |
# File 'lib/rigor/analysis/result.rb', line 11 def initialize(diagnostics: [], stats: nil) @diagnostics = diagnostics @stats = stats end |
Instance Attribute Details
#diagnostics ⇒ Array[Diagnostic] (readonly)
Returns the value of attribute diagnostics.
6 7 8 |
# File 'lib/rigor/analysis/result.rb', line 6 def diagnostics @diagnostics end |
#stats ⇒ RunStats? (readonly)
Returns the value of attribute stats.
6 7 8 |
# File 'lib/rigor/analysis/result.rb', line 6 def stats @stats end |
Instance Method Details
#error_count ⇒ Integer
20 21 22 |
# File 'lib/rigor/analysis/result.rb', line 20 def error_count diagnostics.count(&:error?) end |
#success? ⇒ Boolean
16 17 18 |
# File 'lib/rigor/analysis/result.rb', line 16 def success? diagnostics.none?(&:error?) end |
#to_h ⇒ Hash[String, untyped]
24 25 26 27 28 29 30 31 32 |
# File 'lib/rigor/analysis/result.rb', line 24 def to_h hash = { "success" => success?, "error_count" => error_count, "diagnostics" => diagnostics.map(&:to_h) } hash["stats"] = @stats.to_h if @stats hash end |