Ruby: Document getACapture

This commit is contained in:
Harry Maclean
2021-11-08 08:40:55 +00:00
committed by Harry Maclean
parent 870c6d7412
commit 751d8a7f59

View File

@@ -161,6 +161,16 @@ module ActionDispatch {
result = call.getKeywordArgument("module").getValueText()
}
/**
* Get a URL capture. This is a wildcard URL segment whose value is placed in `params`.
* For example, in
* ```ruby
* get "/foo/:bar/baz", to: "users#index"
* ```
* the capture is `:bar`.
* We don't currently make use of this, but it may be useful in future to more accurately
* model the contents of the `params` hash.
*/
string getACapture() { result = getPathComponent().regexpFind(":[^:/]+", _, _) }
}