Class: Ask::Eval::Judge::Result
- Inherits:
-
Object
- Object
- Ask::Eval::Judge::Result
- Defined in:
- lib/ask/eval/judge.rb
Overview
The verdict from a judge evaluation.
Instance Attribute Summary collapse
-
#cost ⇒ Hash?
readonly
Cost breakdown if tracking was enabled.
-
#passed ⇒ Boolean
readonly
Whether the output passed the check.
-
#reason ⇒ String
readonly
Explanation from the judge.
-
#score ⇒ Float
readonly
Score from 0.0 to 1.0.
Instance Method Summary collapse
-
#initialize(passed:, score:, reason:, cost: nil) ⇒ Result
constructor
A new instance of Result.
- #inspect ⇒ String
- #to_h ⇒ Hash
Constructor Details
#initialize(passed:, score:, reason:, cost: nil) ⇒ Result
Returns a new instance of Result.
55 56 57 58 59 60 61 |
# File 'lib/ask/eval/judge.rb', line 55 def initialize(passed:, score:, reason:, cost: nil) @passed = passed @score = score @reason = reason @cost = cost freeze end |
Instance Attribute Details
#cost ⇒ Hash? (readonly)
Returns cost breakdown if tracking was enabled.
53 54 55 |
# File 'lib/ask/eval/judge.rb', line 53 def cost @cost end |
#passed ⇒ Boolean (readonly)
Returns whether the output passed the check.
44 45 46 |
# File 'lib/ask/eval/judge.rb', line 44 def passed @passed end |
#reason ⇒ String (readonly)
Returns explanation from the judge.
50 51 52 |
# File 'lib/ask/eval/judge.rb', line 50 def reason @reason end |
#score ⇒ Float (readonly)
Returns score from 0.0 to 1.0.
47 48 49 |
# File 'lib/ask/eval/judge.rb', line 47 def score @score end |
Instance Method Details
#inspect ⇒ String
69 70 71 72 |
# File 'lib/ask/eval/judge.rb', line 69 def inspect status = @passed ? "PASS" : "FAIL" "#<Judge::Result #{status} score=#{@score} reason=#{@reason[0..80].inspect}>" end |
#to_h ⇒ Hash
64 65 66 |
# File 'lib/ask/eval/judge.rb', line 64 def to_h { passed: @passed, score: @score, reason: @reason, cost: @cost }.compact end |