Class: CleanArchitecture::Serializers::HtmlResponseFromResult
- Inherits:
-
Object
- Object
- CleanArchitecture::Serializers::HtmlResponseFromResult
- 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.
12 13 14 15 |
# File 'lib/clean_architecture/serializers/html_response_from_result.rb', line 12 def initialize(result, http_method) @result = result @http_method = http_method end |
Instance Method Details
#to_h ⇒ Object
17 18 19 20 21 22 |
# File 'lib/clean_architecture/serializers/html_response_from_result.rb', line 17 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 |