hanami/router

Programmatical access to routes

jodosha opened this issue · 3 comments

This is a request from @solnic: we should ensure that Hanami::Router offers a programmatical access to its routes.


Ref https://trello.com/c/lV4KEFRy

@jodosha @solnic can you expand the description of this issue? just to know what your thoughts are.

@solnic Ping. 😸


FWIW the new router has @routes instance variable, which is an array of Hanami::Routing::Route. Each route object has a complete set of information regarding the path, the name, and the endpoint.

https://github.com/hanami/router/blob/unstable/lib/hanami/routing.rb#L102


There is a no longer used getter Hanami::Router#routes that we can use to return @routes. In this way you can probably achieve the goal of the programmatic access to the routes.

https://github.com/hanami/router/blob/unstable/lib/hanami/router.rb#L280


@solnic Please let us to know. Thanks.

Closing as not actionable.