module Roda::RodaPlugins::R

  1. lib/roda/plugins/r.rb

The r plugin adds an r instance method that will return the request. This allows you to use common Roda idioms such as r.halt and r.redirect even when r isn’t a local variable in scope. Example:

plugin :r

def foo
  r.redirect "/bar"
end

route do |r|
  r.get "foo" do
    foo
  end
  r.get "bar" do
    "bar"
  end
end