Hypermedia presentation logic for Strelka
HTTP responses
The presenter to use when negotiating the response
Initialize some instance variables when a new response is created.
# File lib/strelka/httpresponse/presenters.rb, line 12
def initialize( * )
@presenter = nil
super
end
Set the entity that should be rendered to form the response body.
# File lib/strelka/httpresponse/presenters.rb, line 34
def present( entity, **options )
Yaks::Format.all.each do |format|
self.for( format.media_type ) do
opts = options.merge( format: format.format_name, env: self )
self.presenter.call( entity, opts )
end
end
end