mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Merge branch 'master' of github.com:sinatra/sinatra
This commit is contained in:
commit
9359c2eca7
2 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -80,6 +80,12 @@ via the <tt>params[:splat]</tt> array:
|
|||
params[:splat] # => ["path/to/file", "xml"]
|
||||
end
|
||||
|
||||
Or with block parameters:
|
||||
|
||||
get '/download/*.*' do |path, ext|
|
||||
[path, ext] # => ["path/to/file", "xml"]
|
||||
end
|
||||
|
||||
Route matching with Regular Expressions:
|
||||
|
||||
get %r{/hello/([\w]+)} do
|
||||
|
|
Loading…
Add table
Reference in a new issue