Added wildcard pattern with block parameters in README (ja)

This commit is contained in:
Takanori Ishikawa 2011-05-18 01:09:39 +09:00
parent 4ea9980d2c
commit a44f338395
1 changed files with 6 additions and 0 deletions

View File

@ -67,6 +67,12 @@ Sinatraでは、ルートはHTTPメソッドとURLマッチングパターンが
params[:splat] # => ["path/to/file", "xml"]
end
ブロックパラーメータを使用した場合:
get '/download/*.*' do |path, ext|
[path, ext] # => ["path/to/file", "xml"]
end
正規表現を使ったルート:
get %r{/hello/([\w]+)} do