Rails 3 routing DSL implementation
I picked out the bare essentials from the rails 3 routing code to expose how this DSL is implemented. Here it is.
RouteSet’s responsibility is to store the routes. It hands off responsibility for creating those routes to Mapper.
Mapper contains the DSL, the high level API layered onto RouteSet.