Class: Ibex::Verify::Result
- Inherits:
-
Object
- Object
- Ibex::Verify::Result
- Defined in:
- lib/ibex/verify/result.rb,
sig/ibex/verify/result.rbs
Overview
Immutable independent-verification report.
Instance Attribute Summary collapse
- #algorithm ⇒ String readonly
- #bounds ⇒ Hash[Symbol, Integer] readonly
- #checks ⇒ Array[String] readonly
- #strict ⇒ Boolean readonly
- #violations ⇒ Array[Violation] readonly
Instance Method Summary collapse
-
#initialize(algorithm:, strict:, checks:, violations:, bounds:) ⇒ Result
constructor
A new instance of Result.
- #to_h ⇒ Hash[Symbol, report_value]
- #valid? ⇒ Boolean
Constructor Details
#initialize(algorithm:, strict:, checks:, violations:, bounds:) ⇒ Result
Returns a new instance of Result.
40 41 42 43 44 45 46 47 |
# File 'lib/ibex/verify/result.rb', line 40 def initialize(algorithm:, strict:, checks:, violations:, bounds:) @algorithm = algorithm.freeze @strict = strict @checks = checks.dup.freeze @violations = violations.dup.freeze @bounds = bounds.dup.freeze freeze end |
Instance Attribute Details
#algorithm ⇒ String (readonly)
32 33 34 |
# File 'lib/ibex/verify/result.rb', line 32 def algorithm @algorithm end |
#bounds ⇒ Hash[Symbol, Integer] (readonly)
36 37 38 |
# File 'lib/ibex/verify/result.rb', line 36 def bounds @bounds end |
#checks ⇒ Array[String] (readonly)
34 35 36 |
# File 'lib/ibex/verify/result.rb', line 34 def checks @checks end |
#strict ⇒ Boolean (readonly)
33 34 35 |
# File 'lib/ibex/verify/result.rb', line 33 def strict @strict end |
#violations ⇒ Array[Violation] (readonly)
35 36 37 |
# File 'lib/ibex/verify/result.rb', line 35 def violations @violations end |
Instance Method Details
#to_h ⇒ Hash[Symbol, report_value]
53 54 55 56 57 58 59 60 |
# File 'lib/ibex/verify/result.rb', line 53 def to_h { ibex_report: "verify", schema_version: 1, algorithm: @algorithm, strict: @strict, checks: @checks, bounds: @bounds, result: valid? ? "valid" : "invalid", violations: @violations.map(&:to_h) }.freeze end |
#valid? ⇒ Boolean
50 |
# File 'lib/ibex/verify/result.rb', line 50 def valid? = @violations.empty? |