Class: CleanArchitecture::Serializers::JsonResponseFromResult
- Inherits:
-
Object
- Object
- CleanArchitecture::Serializers::JsonResponseFromResult
- Extended by:
- T::Sig
- Defined in:
- lib/clean_architecture/serializers/json_response_from_result.rb
Instance Method Summary collapse
-
#initialize(result, http_method, success_payload_proc) ⇒ JsonResponseFromResult
constructor
A new instance of JsonResponseFromResult.
- #to_h ⇒ Object
Constructor Details
#initialize(result, http_method, success_payload_proc) ⇒ JsonResponseFromResult
Returns a new instance of JsonResponseFromResult.
16 17 18 19 20 |
# File 'lib/clean_architecture/serializers/json_response_from_result.rb', line 16 def initialize(result, http_method, success_payload_proc) @result = T.let(result, Dry::Monads::Result) @http_method = T.let(http_method, String) @success_payload_proc = T.let(success_payload_proc, T.proc.params(success_value: T.untyped).returns(T::Hash[T.untyped, T.untyped])) end |
Instance Method Details
#to_h ⇒ Object
23 24 25 26 27 28 |
# File 'lib/clean_architecture/serializers/json_response_from_result.rb', line 23 def to_h { status: http_status_code, json: json } end |