Class: Hanami::API::Router
- Inherits:
-
Router
- Object
- Router
- Hanami::API::Router
- Defined in:
- lib/hanami/api/router.rb
Overview
Instance Method Summary collapse
- #freeze ⇒ Object private
-
#initialize(block_context: Block::Context, **kwargs) ⇒ Router
constructor
private
A new instance of Router.
- #to_rack_app ⇒ Object private
- #use(middleware, *args, &blk) ⇒ Object private
Constructor Details
#initialize(block_context: Block::Context, **kwargs) ⇒ Router
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 Router.
12 13 14 15 |
# File 'lib/hanami/api/router.rb', line 12 def initialize(block_context: Block::Context, **kwargs) super(block_context: block_context, **kwargs) @stack = Middleware::Stack.new(@path_prefix.to_s) end |
Instance Method Details
#freeze ⇒ 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.
19 20 21 22 23 24 |
# File 'lib/hanami/api/router.rb', line 19 def freeze return self if frozen? remove_instance_variable(:@stack) super end |
#to_rack_app ⇒ 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.
34 35 36 |
# File 'lib/hanami/api/router.rb', line 34 def to_rack_app @stack.finalize(self) end |
#use(middleware, *args, &blk) ⇒ 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.
28 29 30 |
# File 'lib/hanami/api/router.rb', line 28 def use(middleware, *args, &blk) @stack.use(@path_prefix.to_s, middleware, *args, &blk) end |