Class: RegoValidate::OutcomeEmitter::OutcomePayload
- Inherits:
-
Object
- Object
- RegoValidate::OutcomeEmitter::OutcomePayload
- Defined in:
- lib/ruby/rego/cli.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.
920 921 922 |
# File 'lib/ruby/rego/cli.rb', line 920 def initialize(outcome) @outcome = outcome end |
Instance Method Details
#to_h ⇒ Hash{Symbol => Object}
925 926 927 928 929 |
# File 'lib/ruby/rego/cli.rb', line 925 def to_h return { success: true, result: normalize_json(outcome.value) } if outcome.success? { success: false, errors: outcome.errors } end |