rails--rails/actionpack/test/journey
Daniel Colson 754ed1f45b
Restore the behavior of journey root node methods
https://github.com/rails/rails/pull/39935 changed the behavior of
`Path::Pattern#spec` and `Route#ast` to return an `Ast` rather than the
root `Node`. After eager loading, however, we clear out the `Ast` to
limit retained memory and these methods return `nil`.

While these methods are not public and they aren't used internally after
eager loading, having them return `nil` makes it difficult for
applications that had been using these methods to get access to the
root `Node`.

This commit restores the behavior of these two methods to return the
root `Node`. The `Ast` is still available via `Path::Pattern#ast`, and
we still clear it out after eager loading.

Now that spec is a `Node` and not an `Ast` masquerading as one, we can
get rid of the delegate methods on `Ast.

Since `Route#ast` now returns the root `Node`, the newly added
`Route#ast_root` is no longer necessary so I've removed it.

I also removed the unused `@decorated_ast` method, which should have
been removed in https://github.com/rails/rails/pull/39935.
2021-08-12 09:51:38 -04:00
..
gtg actionpack: Improve performance by allowing routes with custom regexes in the FSM. 2021-01-06 09:54:44 +11:00
nodes Introduce Journey::Ast to avoid extra ast walks 2021-07-29 16:23:11 -04:00
path Introduce Journey::Ast to avoid extra ast walks 2021-07-29 16:23:11 -04:00
route/definition Enable `Layout/EmptyLinesAroundAccessModifier` cop 2019-06-13 12:00:45 +09:00
router Enable `Performance/UnfreezeString` cop 2018-09-23 08:56:55 +09:00
route_test.rb Restore the behavior of journey root node methods 2021-08-12 09:51:38 -04:00
router_test.rb feat(rubocop): Add Style/RedundantRegexpEscape 2020-12-08 18:57:09 +00:00
routes_test.rb actionpack: Improve performance by allowing routes with custom regexes in the FSM. 2021-01-06 09:54:44 +11:00