File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change 4
4
5
5
* Your contribution here.
6
6
* [ #1944 ] ( https://github.com/ruby-grape/grape/pull/1944 ) : Reduced attribute_translator string allocations - [ @ericproulx ] ( https://github.com/ericproulx ) .
7
+ * [ #1943 ] ( https://github.com/ruby-grape/grape/pull/1943 ) : Reduce number of regex string allocations - [ @ericproulx ] ( https://github.com/ericproulx ) .
7
8
* [ #1942 ] ( https://github.com/ruby-grape/grape/pull/1942 ) : Optimized retained memory methods - [ @ericproulx ] ( https://github.com/ericproulx ) .
8
9
* [ #1941 ] ( https://github.com/ruby-grape/grape/pull/1941 ) : Frozen string literal - [ @ericproulx ] ( https://github.com/ericproulx ) .
9
10
* [ #1940 ] ( https://github.com/ruby-grape/grape/pull/1940 ) : Get rid of a needless step in HashWithIndifferentAccess - [ @dnesteryuk ] ( https://github.com/dnesteryuk ) .
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def compile!
41
41
routes = map [ method ]
42
42
@optimized_map [ method ] = routes . map . with_index do |route , index |
43
43
route . index = index
44
- route . regexp = /( ?<_#{ index } >#{ route . pattern . to_regexp } )/
44
+ route . regexp = Regexp . new ( "( ?<_#{ index } >#{ route . pattern . to_regexp } )" )
45
45
end
46
46
@optimized_map [ method ] = Regexp . union ( @optimized_map [ method ] )
47
47
end
@@ -53,7 +53,7 @@ def append(route)
53
53
end
54
54
55
55
def associate_routes ( pattern , **options )
56
- regexp = /( ?<_#{ @neutral_map . length } >)#{ pattern . to_regexp } /
56
+ regexp = Regexp . new ( "( ?<_#{ @neutral_map . length } >)#{ pattern . to_regexp } " )
57
57
@neutral_map << Any . new ( pattern , regexp , @neutral_map . length , **options )
58
58
end
59
59
You can’t perform that action at this time.
0 commit comments