Class: AnalyticsOps::Governance::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/analytics_ops/governance.rb,
sig/analytics_ops.rbs

Overview

Governance snapshot paired with its configured findings.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(snapshot:, findings:) ⇒ Result

Returns a new instance of Result.

Parameters:

Raises:

  • (ArgumentError)


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

#findingsArray[Finding] (readonly)

Returns the value of attribute findings.

Returns:



103
104
105
# File 'lib/analytics_ops/governance.rb', line 103

def findings
  @findings
end

#snapshotSnapshot (readonly)

Returns the value of attribute snapshot.

Returns:



103
104
105
# File 'lib/analytics_ops/governance.rb', line 103

def snapshot
  @snapshot
end

Instance Method Details

#compliant?Boolean

Returns:

  • (Boolean)


117
118
119
# File 'lib/analytics_ops/governance.rb', line 117

def compliant?
  findings.empty?
end

#to_hrecord

Returns:

  • (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