Class Merb::Router
In: lib/merb-core/dispatch/router/behavior.rb
lib/merb-core/dispatch/router/cached_proc.rb
lib/merb-core/dispatch/router/route.rb
lib/merb-core/dispatch/router.rb
Parent: Object

Methods

Classes and Modules

Class Merb::Router::Behavior
Class Merb::Router::CachedProc
Class Merb::Router::Route

Constants

SEGMENT_REGEXP = /(:([a-z_][a-z0-9_]*|:))/
SEGMENT_REGEXP_WITH_BRACKETS = /(:[a-z_]+)(\[(\d+)\])?/
JUST_BRACKETS = /\[(\d+)\]/
PARENTHETICAL_SEGMENT_STRING = "([^\/.,;?]+)".freeze

Public Class methods

Appends the generated routes to the current routes.

Parameters

&block:A block that generates new routes when yielded a new Behavior.

Defines the match function for this class based on the compiled_statement.

Returns

String:A routing lambda statement generated from the routes.

Generates a URL based on passed options.

Parameters

name<~to_sym, Hash>:The name of the route to generate.
params<Hash>:The params to use in the route generation.
fallback<Hash>:Parameters for generating a fallback URL.

Returns

String:The generated URL.

Alternatives

If name is a hash, it will be merged with params and passed on to generate_for_default_route along with fallback.

Generates a URL based on the default route scheme of "/:controller/:action/:id.:format".

Parameters

params<Hash>:The primary parameters to create the route from (see below).
fallback<Hash>:Fallback parameters. Same options as params.

Options (params)

:controller<~to_s>:The controller name. Required.
:action<~to_s>:The action name. Required.
:id<~to_s>:The ID for use in the action.
:format<~to_s>:The format of the preferred response.

Returns

String:The generated URL.

Prepares new routes and adds them to existing routes.

Parameters

first<Array>:An array of routes to add before the generated routes.
last<Array>:An array of routes to add after the generated routes.
&block:A block that generates new routes.

Block parameters (&block)

new_behavior<Behavior>:Behavior for child routes.

Prepends the generated routes to the current routes.

Parameters

&block:A block that generates new routes when yielded a new Behavior.

[Validate]