Class: RegoValidate::OutcomeEmitter::OutcomePayload
- Inherits:
-
Object
- Object
- RegoValidate::OutcomeEmitter::OutcomePayload
- Defined in:
- lib/ruby/rego/cli/reporting.rb
Overview
Builds a JSON-serializable payload from an outcome.
Instance Method Summary collapse
-
#initialize(outcome) ⇒ OutcomePayload
constructor
A new instance of OutcomePayload.
-
#to_h ⇒ Hash{Symbol => Object}
Constructor Details
#initialize(outcome) ⇒ OutcomePayload
Returns a new instance of OutcomePayload.
53 54 55 |
# File 'lib/ruby/rego/cli/reporting.rb', line 53 def initialize(outcome) @outcome = outcome end |
Instance Method Details
#to_h ⇒ Hash{Symbol => Object}
58 59 60 61 62 |
# File 'lib/ruby/rego/cli/reporting.rb', line 58 def to_h return { success: true, result: normalize_json(outcome.value) } if outcome.success? { success: false, errors: outcome.errors } end |