Class | Ramaze::AddressableRoute |
In: |
lib/ramaze/contrib/addressable_route.rb
|
Parent: | Object |
This is a simple prototype-implementation of how we could do routing supported by URI templates.
Please see the spec for example usage as it‘s not integrated yet in any way.
What it does is basically that you can give it any URI template and a final mapping, and it will extract the variables from the URI and merge them into the QUERY_STRING, which is parsed again in Ramaze if you issue Request#params.
@example given mapping like:
map('/customer/{customer_id}/order/{order_id}', '/order/show')
@example output of request.params at ’/order/show‘
{'customer_id => '12', 'order_id' => '15'}
I haven‘t explored the full capabilities of the templates yet, but the specs of Addressable::Template suggest that there is a lot to be discovered.