Class: Vangrail::BenchmarkRun

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ BenchmarkRun

Returns a new instance of BenchmarkRun.

Raises:



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

#dataObject (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_hObject



28
29
30
# File 'lib/vangrail/benchmark_run.rb', line 28

def to_h
  data
end