module Roda::RodaPlugins::RouteBlockArgs

  1. lib/roda/plugins/route_block_args.rb

The route_block_args plugin lets you customize what arguments are passed to the route block. So if you have an application that always needs access to the response, the params, the env, or the session, you can use this plugin so that any of those can be arguments to the route block. Example:

class App < Roda
  plugin :route_block_args do
    [request, request.params, response]

  route do |r, params, res| do
      artist = Artist.create(name: params['name'].to_s)
      res.status = 201


Public Class

  1. configure

Public Class methods

configure(app, &block)
[show source]
   # File lib/roda/plugins/route_block_args.rb
26 def self.configure(app, &block)
27   app.instance_exec do 
28     define_roda_method(:_roda_route_block_args, 0, &block)
29     route(&@raw_route_block) if @raw_route_block
30   end
31 end