gems hanami-router 3.1.0.rc1
v3.1.0.rc1

one hour ago

Added

  • Add Hanami::Router#routes, returning a frozen array of the router's routes, in the order they were defined. The router now records its routes at all times, so they are available at runtime (for example, to list them on a "not found" error page). (@afomera and @timriley in #306)
  • Make Hanami::Router::Formatter::HumanFriendly and Hanami::Router::Formatter::CSV public API. A formatter is any object that responds to #call(routes, **options) and returns a String. Use one to render routes: Hanami::Router::Formatter::HumanFriendly.new.call(router.routes). (@timriley in #306)
  • Support for HTTP QUERY method. (@katafrakt in #307)

Changed

  • Generate most paths without Mustermann, making #path and #url around 10 times faster, and routers with many named routes quicker to build. (@parndt in #311)
  • Raise FrozenError when adding a route to, or mounting an app on, a frozen router. Previously, the route was added to the routing tables and served requests, even though the router was frozen. (@timriley in #306)

Removed

  • BREAKING: Remove Hanami::Router::Inspector, the inspector: argument to Hanami::Router.new, and Hanami::Router#inspector. Use #routes with a formatter instead: Hanami::Router::Formatter::HumanFriendly.new.call(router.routes). If you use hanami and hanami-cli, upgrade those to v3.1, which use the formatters directly. (@timriley in #306)

Fixed

  • Allow route names to give only a prefix, with an as: of [prefix, nil]. Previously, this gave a name with a trailing underscore. For example, scope "admin" do get "/", to: dashboard, as: [:dashboard, nil] end now gives dashboard_admin, rather than dashboard_admin_. (@timriley in #314)
  • Record the full prefixed path for apps mounted within a scope or under a router prefix. Previously, mount app, at: "/api" within scope "v1" was listed with the path /api instead of /v1/api. (@timriley in #306)
  • Trie#find keeps every path it looks up. (@aaronmallen in #312)

Compare v3.0.1 ... v3.1.0.rc1

Don't miss a new hanami-router release

NewReleases is sending notifications on new releases.