Class: Hanami::CLI::MiddlewareStackInspector Private
- Inherits:
-
Object
- Object
- Hanami::CLI::MiddlewareStackInspector
- Defined in:
- lib/hanami/cli/middleware_stack_inspector.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.
Instance Method Summary collapse
-
#initialize(stack:) ⇒ MiddlewareStackInspector
constructor
private
A new instance of MiddlewareStackInspector.
- #inspect(include_arguments: false) ⇒ Object private
Constructor Details
#initialize(stack:) ⇒ MiddlewareStackInspector
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.
Returns a new instance of MiddlewareStackInspector.
10 11 12 |
# File 'lib/hanami/cli/middleware_stack_inspector.rb', line 10 def initialize(stack:) @stack = stack end |
Instance Method Details
#inspect(include_arguments: false) ⇒ 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.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hanami/cli/middleware_stack_inspector.rb', line 16 def inspect(include_arguments: false) max_path_length = @stack.map { |(path)| path.length }.max @stack.map { |path, middleware| middleware.map { |(mware, arguments)| "#{path.ljust(max_path_length + 3)} #{format_middleware(mware)}".tap { |line| line << " #{format_arguments(arguments)}" if include_arguments } } }.join("\n") + "\n" end |