Module: Radical

Defined in:
lib/radical/app.rb,
lib/radical.rb,
lib/radical/env.rb,
lib/radical/form.rb,
lib/radical/view.rb,
lib/radical/asset.rb,
lib/radical/flash.rb,
lib/radical/model.rb,
lib/radical/table.rb,
lib/radical/assets.rb,
lib/radical/router.rb,
lib/radical/routes.rb,
lib/radical/strings.rb,
lib/radical/database.rb,
lib/radical/generator.rb,
lib/radical/migration.rb,
lib/radical/controller.rb,
lib/radical/asset_compiler.rb,
lib/radical/security_headers.rb

Overview

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/:^#‘(?<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

Defined Under Namespace

Classes: App, Asset, AssetCompiler, Assets, CaptureEngine, Controller, Database, Env, Flash, Form, Generator, Migration, Model, ModelNotFound, Router, Routes, SecurityHeaders, Strings, Table, View

Class Method Summary collapse

Class Method Details

.envObject



12
13
14
# File 'lib/radical.rb', line 12

def self.env
  Radical::Env
end