Class: AnalyticsOps::Governance::Result
- Inherits:
-
Object
- Object
- AnalyticsOps::Governance::Result
- Defined in:
- lib/analytics_ops/governance.rb,
sig/analytics_ops.rbs
Overview
Governance snapshot paired with its configured findings.
Instance Attribute Summary collapse
-
#findings ⇒ Array[Finding]
readonly
Returns the value of attribute findings.
-
#snapshot ⇒ Snapshot
readonly
Returns the value of attribute snapshot.
Instance Method Summary collapse
- #compliant? ⇒ Boolean
-
#initialize(snapshot:, findings:) ⇒ Result
constructor
A new instance of Result.
- #to_h ⇒ record
Constructor Details
#initialize(snapshot:, findings:) ⇒ Result
Returns a new instance of Result.
105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/analytics_ops/governance.rb', line 105 def initialize(snapshot:, findings:) raise ArgumentError, "snapshot must be a governance snapshot" unless snapshot.is_a?(Snapshot) unless findings.is_a?(Array) && findings.all?(Finding) raise ArgumentError, "findings must be governance findings" end @snapshot = snapshot @findings = findings.dup.freeze freeze end |
Instance Attribute Details
#findings ⇒ Array[Finding] (readonly)
Returns the value of attribute findings.
103 104 105 |
# File 'lib/analytics_ops/governance.rb', line 103 def findings @findings end |
#snapshot ⇒ Snapshot (readonly)
Returns the value of attribute snapshot.
103 104 105 |
# File 'lib/analytics_ops/governance.rb', line 103 def snapshot @snapshot end |
Instance Method Details
#compliant? ⇒ Boolean
117 118 119 |
# File 'lib/analytics_ops/governance.rb', line 117 def compliant? findings.empty? end |
#to_h ⇒ record
121 122 123 124 125 126 127 128 |
# File 'lib/analytics_ops/governance.rb', line 121 def to_h { "experimental" => true, "compliant" => compliant?, "snapshot" => snapshot.to_h, "findings" => findings.map(&:to_h) } end |