Class: CleanArchitecture::Serializers::HtmlResponseFromResult

Inherits:
Object
  • Object
show all
Defined in:
lib/clean_architecture/serializers/html_response_from_result.rb

Instance Method Summary collapse

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_hObject



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