Class Rack::Mount::RouteSet
In: lib/rack/mount/route_set.rb
Parent: Object

Methods

Constants

X_CASCADE = 'X-Cascade'.freeze
PASS = 'pass'.freeze
PATH_INFO = 'PATH_INFO'.freeze

Public Class methods

Basic RouteSet initializer.

If a block is given, the set is yielded and finalized.

See other aspects for other valid options:

Public Instance methods

Builder method to add a route to the set

app:A valid Rack app to call if the conditions are met.
conditions:A hash of conditions to match against. Conditions may be expressed as strings or regexps to match against.
defaults:A hash of values that always gets merged in
name:Symbol identifier for the route used with named route generations

Rack compatible recognition and dispatching method. Routes are tried until one returns a non-catch status code. If no routes match, then catch status code is returned.

This method can only be invoked after the RouteSet has been finalized.

Finalizes the set and builds optimized data structures. You must freeze the set before you can use call and url. So remember to call freeze after you are done adding routes.

Number of routes in the set

Generates a url from Rack env and identifiers or significant keys.

To generate a url by named route, pass the name in as a Symbol.

  url(env, :dashboard) # => "/dashboard"

Additional parameters can be passed in as a hash

  url(env, :people, :id => "1") # => "/people/1"

If no named route is given, it will fall back to a slower generation search.

  url(env, :controller => "people", :action => "show", :id => "1")
    # => "/people/1"

Protected Instance methods

[Validate]