Class: Vangrail::BenchmarkRun
- Inherits:
-
Object
- Object
- Vangrail::BenchmarkRun
- Includes:
- ArtifactData
- Defined in:
- lib/vangrail/benchmark_run.rb
Overview
Immutable per-case benchmark results with explicit denominator accounting.
Constant Summary collapse
- SCHEMA =
'vangrail-benchmark-run-v1'- STATUSES =
%w[ok error abstained].freeze
- FIELDS =
%w[ schema adapter benchmark target attack seed source cases status_counts denominator ].freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(raw) ⇒ BenchmarkRun
constructor
A new instance of BenchmarkRun.
- #to_h ⇒ Object
Constructor Details
#initialize(raw) ⇒ BenchmarkRun
Returns a new instance of BenchmarkRun.
19 20 21 22 23 24 25 26 |
# File 'lib/vangrail/benchmark_run.rb', line 19 def initialize(raw) raise ArtifactError, 'benchmark run must be a hash' unless raw.is_a?(Hash) @data = stringify(raw) validate! @data = immutable(@data) freeze end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
17 18 19 |
# File 'lib/vangrail/benchmark_run.rb', line 17 def data @data end |
Instance Method Details
#to_h ⇒ Object
28 29 30 |
# File 'lib/vangrail/benchmark_run.rb', line 28 def to_h data end |