Class: CleanArchitecture::Serializers::HtmlResponseFromResult
- Inherits:
-
Object
- Object
- CleanArchitecture::Serializers::HtmlResponseFromResult
- Extended by:
- T::Sig
- Defined in:
- lib/clean_architecture/serializers/html_response_from_result.rb
Instance Method Summary collapse
-
#initialize(result, http_method) ⇒ HtmlResponseFromResult
constructor
A new instance of HtmlResponseFromResult.
- #to_h ⇒ Object
Constructor Details
#initialize(result, http_method) ⇒ HtmlResponseFromResult
Returns a new instance of HtmlResponseFromResult.
15 16 17 18 |
# File 'lib/clean_architecture/serializers/html_response_from_result.rb', line 15 def initialize(result, http_method) @result = result @http_method = http_method end |
Instance Method Details
#to_h ⇒ Object
21 22 23 24 25 26 |
# File 'lib/clean_architecture/serializers/html_response_from_result.rb', line 21 def to_h Matchers::UseCaseResult.call(@result) do |matcher| matcher.success { |data| success_html_response(data) } matcher.failure { |failure_details| failure_html_response(failure_details) } end end |