Module: Thronglets::Concerns::Output
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/thronglets/concerns/output.rb
Defined Under Namespace
Classes: OutputValidationError
Instance Attribute Summary collapse
-
#output_errors ⇒ Object
readonly
Returns the value of attribute output_errors.
-
#output_result ⇒ Object
readonly
Returns the value of attribute output_result.
Instance Method Summary collapse
Instance Attribute Details
#output_errors ⇒ Object (readonly)
Returns the value of attribute output_errors.
8 9 10 |
# File 'lib/thronglets/concerns/output.rb', line 8 def output_errors @output_errors end |
#output_result ⇒ Object (readonly)
Returns the value of attribute output_result.
8 9 10 |
# File 'lib/thronglets/concerns/output.rb', line 8 def output_result @output_result end |
Instance Method Details
#validate_output!(data) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/thronglets/concerns/output.rb', line 31 def validate_output!(data) @output_result = output_schema.call(data) output_result_data = output_result.to_h.as_json @output_errors = output_result.errors.to_h return output_result_data if output_errors.blank? raise OutputValidationError, output_errors end |