Module: Thronglets::Concerns::Input
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/thronglets/concerns/input.rb
Defined Under Namespace
Classes: InputValidationError
Instance Attribute Summary collapse
-
#input_errors ⇒ Object
readonly
Returns the value of attribute input_errors.
-
#input_result ⇒ Object
readonly
Returns the value of attribute input_result.
Instance Method Summary collapse
Instance Attribute Details
#input_errors ⇒ Object (readonly)
Returns the value of attribute input_errors.
8 9 10 |
# File 'lib/thronglets/concerns/input.rb', line 8 def input_errors @input_errors end |
#input_result ⇒ Object (readonly)
Returns the value of attribute input_result.
8 9 10 |
# File 'lib/thronglets/concerns/input.rb', line 8 def input_result @input_result end |
Instance Method Details
#validate_input!(args) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/thronglets/concerns/input.rb', line 31 def validate_input!(args) return args unless input_schema @input_result = input_schema.call(args) input_result_data = input_result.to_h.as_json @input_errors = input_result.errors.to_h return input_result_data if input_errors.blank? raise InputValidationError, input_errors end |