seancribbs/webmachine-ruby — pull request #25 by 1000jobboersen (2012-01-12 13:15:59+00:00)
Title: Route accepts optional list of guard blocks

This feature brings the routing features in line with that of the erlang version. Thus, the following:

```erlang
%% https://github.com/basho/riak_kv/blob/master/src/riak_kv_web.erl
[
{["buckets", bucket, "keys"], fun is_post/1,
riak_kv_wm_object, Props2},

{["buckets", bucket, "keys"],
riak_kv_wm_keylist, Props2},

{["buckets", bucket, "keys", key],
riak_kv_wm_object, Props2}
].
```

Becomes:

```ruby
Webmachine.application.routes do
add ["buckets", :bucket, "keys"],
->(r) { r.method == "POST" },
Riak::KV::WM::Object
add ["buckets", :bucket, "keys"], Riak::KV::WM::KeyList
add ["buckets", :bucket, "keys", :key], Riak::KV::WM::Object
end
```