Class: Bparity::Reporting::AssuranceMatrix
- Inherits:
-
Object
- Object
- Bparity::Reporting::AssuranceMatrix
- Defined in:
- lib/bparity/reporting.rb
Constant Summary collapse
- PROVENANCE =
%w[A B C D].freeze
- FORMAL =
%w[F0 F1 F2 F3 F4].freeze
Instance Method Summary collapse
-
#initialize(bundle) ⇒ AssuranceMatrix
constructor
A new instance of AssuranceMatrix.
- #to_h ⇒ Object
Constructor Details
#initialize(bundle) ⇒ AssuranceMatrix
Returns a new instance of AssuranceMatrix.
12 13 14 |
# File 'lib/bparity/reporting.rb', line 12 def initialize(bundle) @bundle = bundle end |
Instance Method Details
#to_h ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bparity/reporting.rb', line 16 def to_h matrix = PROVENANCE.to_h { |provenance| [provenance, FORMAL.to_h { |formal| [formal, 0] }] } items.each do |item| provenance = item.fetch("provenance_level", "D") formal = item.fetch("formal_level", "F0") matrix.fetch(provenance).fetch(formal) matrix[provenance][formal] += 1 end matrix end |