Class: Ibex::Verify::Result
- Inherits:
-
Object
- Object
- Ibex::Verify::Result
- Defined in:
- lib/ibex/verify/result.rb
Overview
Immutable independent-verification report.
Instance Attribute Summary collapse
-
#algorithm ⇒ Object
readonly
@rbs! type report_value = String | Integer | bool | Array | Hash[Symbol, Integer] | Array[Hash[Symbol, String]].
-
#bounds ⇒ Object
readonly
: Hash[Symbol, Integer].
-
#checks ⇒ Object
readonly
: Array.
-
#strict ⇒ Object
readonly
: bool.
-
#violations ⇒ Object
readonly
: Array.
Instance Method Summary collapse
-
#initialize(algorithm:, strict:, checks:, violations:, bounds:) ⇒ Result
constructor
A new instance of Result.
- #to_h ⇒ Object
- #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 ⇒ Object (readonly)
@rbs! type report_value = String | Integer | bool | Array | Hash[Symbol, Integer] | Array[Hash[Symbol, String]]
32 33 34 |
# File 'lib/ibex/verify/result.rb', line 32 def algorithm @algorithm end |
#bounds ⇒ Object (readonly)
: Hash[Symbol, Integer]
36 37 38 |
# File 'lib/ibex/verify/result.rb', line 36 def bounds @bounds end |
#checks ⇒ Object (readonly)
: Array
34 35 36 |
# File 'lib/ibex/verify/result.rb', line 34 def checks @checks end |
#strict ⇒ Object (readonly)
: bool
33 34 35 |
# File 'lib/ibex/verify/result.rb', line 33 def strict @strict end |
#violations ⇒ Object (readonly)
: Array
35 36 37 |
# File 'lib/ibex/verify/result.rb', line 35 def violations @violations end |
Instance Method Details
#to_h ⇒ Object
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? |