Class: Hanami::CLI::Commands::App::Middleware Private

Inherits:
Hanami::CLI::Command show all
Defined in:
lib/hanami/cli/commands/app/middleware.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.

List registered middleware in the app router

It outputs middleware registered along with the paths where they apply:

$ bundle exec hanami middleware
/    Rack::Session::Cookie

Given arguments can be inspected:

$ bundle exec hanami middleware --with-arguments
/    Rack::Session::Cookie args: [{:secret=>"foo"}]

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(with_arguments: DEFAULT_WITH_ARGUMENTS) ⇒ 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



46
47
48
49
50
51
52
53
# File 'lib/hanami/cli/commands/app/middleware.rb', line 46

def call(with_arguments: DEFAULT_WITH_ARGUMENTS)
  require "hanami/prepare"

  if Hanami.app.router
    inspector = MiddlewareStackInspector.new(stack: Hanami.app.router.middleware_stack)
    out.puts inspector.inspect(include_arguments: with_arguments)
  end
end