Skip to content

Commit 751d8a7

Browse files
committed
Ruby: Document getACapture
1 parent 870c6d7 commit 751d8a7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ruby/ql/lib/codeql/ruby/frameworks/ActionDispatch.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ module ActionDispatch {
161161
result = call.getKeywordArgument("module").getValueText()
162162
}
163163

164+
/**
165+
* Get a URL capture. This is a wildcard URL segment whose value is placed in `params`.
166+
* For example, in
167+
* ```ruby
168+
* get "/foo/:bar/baz", to: "users#index"
169+
* ```
170+
* the capture is `:bar`.
171+
* We don't currently make use of this, but it may be useful in future to more accurately
172+
* model the contents of the `params` hash.
173+
*/
164174
string getACapture() { result = getPathComponent().regexpFind(":[^:/]+", _, _) }
165175
}
166176

0 commit comments

Comments
 (0)