Class: Hanami::CLI::Commands::App::Routes Private

Inherits:
Hanami::CLI::Command show all
Defined in:
lib/hanami/cli/commands/app/routes.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Inspect the application routes

All the formatters available from hanami-router are available:

$ bundle exec hanami routes --format=csv

Experimental: You can also use a custom formatter registered in the application container. You can identify it by its key:

$ bundle exec hanami routes --format=custom_routes_formatter

Since:

  • 2.0.0

Instance Method Summary collapse

Methods inherited from Hanami::CLI::Command

#initialize, new

Constructor Details

This class inherits a constructor from Hanami::CLI::Command

Instance Method Details

#call(format: DEFAULT_FORMAT) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



54
55
56
57
58
59
60
# File 'lib/hanami/cli/commands/app/routes.rb', line 54

def call(format: DEFAULT_FORMAT, **)
  require "hanami/router/inspector"
  require "hanami/prepare"
  inspector = Hanami::Router::Inspector.new(formatter: resolve_formatter(format))
  app.router(inspector: inspector)
  out.puts inspector.call
end