Strelka::HTTPResponse::

Presenters

module

Hypermedia presentation logic for Strelka HTTP responses

Attributes

presenter[RW]

The presenter to use when negotiating the response

Public Class Methods

anchor
new( * )

Initialize some instance variables when a new response is created.

# File lib/strelka/httpresponse/presenters.rb, line 12
def initialize( * )
        @presenter = nil
        super
end

Public Instance Methods

anchor
present( entity, **options )

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