module Roda::RodaPlugins::Base::InstanceMethods
def _route(&block)
Internals of #call, extracted so that plugins can override
def _route(&block) catch(:halt) do r = @_request r.block_result(instance_exec(r, &block)) @_response.finish end end
def call(env, &block)
the request, handling any halts. This is not usually
class, the instance_exec the route block with
Create a request and response of the appopriate
def call(env, &block) @_request = self.class::RodaRequest.new(self, env) @_response = self.class::RodaResponse.new _route(&block) end
def env
The environment hash for the current request. Example:
def env @_request.env end
def opts
opts[:render_opts].inspect
Roda.route do |r|
Roda.plugin :render
modified at the instance level. Example:
The class-level options hash. This should probably not be
def opts self.class.opts end
def request
The instance of the request class related to this request.
def request @_request end
def response
def response @_response end
def session
if no session exists. Example:
The session hash for the current request. Raises RodaError
def session @_request.session end