module Roda::RodaPlugins::Base::InstanceMethods
def _roda_handle_main_route
Handle dispatching to the main route, catching :halt and handling
def _roda_handle_main_route catch(:halt) do r = @_request r.block_result(_roda_run_main_route(r)) @_response.finish end end
def _roda_handle_route
Treat the given block as a routing block, catching :halt if
def _roda_handle_route catch(:halt) do @_request.block_result(yield) @_response.finish end end
def _roda_main_route(_)
Default implementation of the main route, usually overridden
def _roda_main_route(_) end
def _roda_run_main_route(r)
Run the main route block with the request. Designed for
def _roda_run_main_route(r) _roda_main_route(r) end
def call(&block)
def call(&block) # RODA4: Remove catch(:halt) do r = @_request r.block_result(instance_exec(r, &block)) # Fallback @_response.finish end end
def env
The environment hash for the current request. Example:
def env @_request.env end
def initialize(env)
def initialize(env) klass = self.class @_request = klass::RodaRequest.new(self, env) @_response = klass::RodaResponse.new 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 session
if no session exists. Example:
The session hash for the current request. Raises RodaError
def session @_request.session end