Skip to content

Commit b2d6539

Browse files
committed
Use named regex match for param array type extraction
1 parent 64897b5 commit b2d6539

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/grape-swagger/doc_methods.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def parse_params(params, path, method)
4747
'double'
4848
when 'Symbol'
4949
'string'
50-
when /^\[(.*)\]$/
51-
items[:type] = Regexp.last_match[1].downcase
50+
when /^\[(?<type>.*)\]$/
51+
items[:type] = Regexp.last_match[:type].downcase
5252
if PRIMITIVE_MAPPINGS.key?(items[:type])
5353
items[:type], items[:format] = PRIMITIVE_MAPPINGS[items[:type]]
5454
end

0 commit comments

Comments
 (0)