module Radical
The main entry point for a Radical
application
Example:
class App
< Radical::App
root Home
end
{ 'PATH_INFO' => '/', 'REQUEST_METHOD' => 'GET' }
)
Dispatches to:
class Controller
< Radical::Controller
# GET / def index head :ok end
end
typed: true
A very naive router for radical
This class loops over routes for each http method (GET, POST, etc.) and checks a simple regex built at startup
‘/users/:id’ => “/users/:^#{path.gsub(/:(w+)/, ‘(?<1>+)’)}$”
Example:
router = Router.new
do
get '/users/:id', to: 'users#show'
end
router.route(
{ 'PATH_INFO' => '/users/1', 'REQUEST_METHOD' => 'GET' }
) => ‘users#show(1)’
Dispatches to:
class UsersController < Controller
def show render plain: "users#show(#{params['id']})" end
end
Public Class Methods
env()
click to toggle source
# File lib/radical.rb, line 12 def self.env Radical::Env end