Class: Raif::Evals::EvalCase
- Inherits:
-
Object
- Object
- Raif::Evals::EvalCase
- Defined in:
- lib/raif/evals/eval_case.rb
Overview
One input row of a Dataset. Eval sets only ever receive these - the dataset block returns plain hashes and Raif builds the cases from them.
Instance Attribute Summary collapse
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(id:, input:, expected: nil) ⇒ EvalCase
constructor
A new instance of EvalCase.
- #to_h ⇒ Object
Constructor Details
#initialize(id:, input:, expected: nil) ⇒ EvalCase
Returns a new instance of EvalCase.
10 11 12 13 14 15 |
# File 'lib/raif/evals/eval_case.rb', line 10 def initialize(id:, input:, expected: nil) @id = id.to_s.freeze @input = input @expected = expected freeze end |
Instance Attribute Details
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
8 9 10 |
# File 'lib/raif/evals/eval_case.rb', line 8 def expected @expected end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/raif/evals/eval_case.rb', line 8 def id @id end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
8 9 10 |
# File 'lib/raif/evals/eval_case.rb', line 8 def input @input end |
Instance Method Details
#[](key) ⇒ Object
19 20 21 |
# File 'lib/raif/evals/eval_case.rb', line 19 def [](key) input[key] end |
#to_h ⇒ Object
23 24 25 |
# File 'lib/raif/evals/eval_case.rb', line 23 def to_h { id: id, input: input, expected: expected }.compact end |