1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/lib/action_dispatch/routing
eileencodes 5d1b7c3b44 Remove literal? check to fix issue with prefixed optionals
In commit d993cb3 `build_path` was changed from using `grep` to
`find_all` to save array allocations.

This change was a little too aggressive in that when the dash comes
before the symbol like `/omg-:song` the symbol is skipped.

Removing the check for `n.right.left.literal?` fixes this issue, but
does add back some allocations. The number of allocations are still well
less than before.

I've added a regression test to test this behavior for the future.

Fixes #23069.

Array allocations as of d993cb3:

```
{:T_SYMBOL=>11}
{:T_REGEXP=>17}
{:T_STRUCT=>6500}
{:T_MATCH=>12004}
{:T_OBJECT=>91009}
{:T_DATA=>100088}
{:T_HASH=>114013}
{:T_STRING=>159637}
{:T_ARRAY=>321056}
{:T_IMEMO=>351133}
```

Array allocations after this change:

```
{:T_SYMBOL=>11}
{:T_REGEXP=>1017}
{:T_STRUCT=>6500}
{:T_MATCH=>12004}
{:T_DATA=>84092}
{:T_OBJECT=>87009}
{:T_HASH=>110015}
{:T_STRING=>166152}
{:T_ARRAY=>322056}
{:T_NODE=>343558}
```
2016-01-16 15:00:18 -05:00
..
endpoint.rb give all endpoints a superclass 2014-05-27 12:10:24 -07:00
inspector.rb Better error message when running rake routes with CONTROLLER arg: 2016-01-07 06:35:40 -05:00
mapper.rb Remove literal? check to fix issue with prefixed optionals 2016-01-16 15:00:18 -05:00
polymorphic_routes.rb refactor handle_model to use private helper methods for generation 2015-03-01 16:16:15 -08:00
redirection.rb whitespace 2015-08-08 15:41:36 -07:00
route_set.rb Allow AC::Parameters as an argument to url_helpers 2016-01-07 12:12:34 +05:30
routes_proxy.rb Make the helpers a required argument 2015-02-19 15:11:08 -08:00
url_for.rb Prevent ActionController::Parameters from being passed to url_for directly 2015-12-15 13:16:54 +01:00