Class: Chusaku::Routes
- Inherits:
-
Object
- Object
- Chusaku::Routes
- Defined in:
- lib/chusaku/routes.rb
Overview
Handles extracting information about the Rails project’s routes.
Class Method Summary collapse
-
.call ⇒ Hash
Primary method to call.
Class Method Details
.call ⇒ Hash
Primary method to call.
Example output:
{
"users" => {
"edit" => [
{
verb: "GET",
path: "/users/:id",
name: "edit_user",
defaults: {},
source_path: "/path/to/users_controller.rb"
}
],
"update" => [
{
verb: "PATCH",
path: "/users",
name: "edit_user",
defaults: {},
source_path: "/path/to/users_controller.rb"
},
{
verb: "PUT",
path: "/users",
name: "edit_user",
defaults: {},
source_path: "/path/to/users_controller.rb"
}
]
},
"empanadas" => {
"create" => [
{
verb: "POST",
path: "/empanadas",
name: nil,
defaults: {},
source_path: "/path/to/empanadas_controller.rb"
}
]
}
}
51 52 53 54 55 56 |
# File 'lib/chusaku/routes.rb', line 51 def call routes = {} populate_routes(Rails.application, routes) backfill_routes(routes) end |