module Roda::RodaPlugins::Base::InstanceMethods
def _roda_handle_main_route
the result of the block.
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
thrown by the block.
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(_)
by Roda.route.
Default implementation of the main route, usually overridden
def _roda_main_route(_) end
def _roda_run_main_route(r)
extension by plugins
Run the main route block with the request. Designed for
def _roda_run_main_route(r) _roda_main_route(r) end
def call(&block)
Deprecated method for the previous main route dispatch API.
def call(&block) # RODA4: Remove catch(:halt) do r = @_request r.block_result(instance_exec(r, &block)) # Fallback @_response.finish end end
def env
env # => ‘GET’
The environment hash for the current request. Example:
def env @_request.env end
def initialize(env)
Create a request and response of the appropriate class
def initialize(env) klass = self.class @_request = klass::RodaRequest.new(self, env) @_response = klass::RodaResponse.new end
def opts
end<br>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
session # => {}
if no session exists. Example:
The session hash for the current request. Raises RodaError
def session @_request.session end