Class: Hanami::API::Router
- Inherits:
-
Router
- Object
- Router
- Hanami::API::Router
- Defined in:
- lib/hanami/api/router.rb
Overview
Instance Attribute Summary collapse
- #inspector ⇒ Object readonly private
Instance Method Summary collapse
- #freeze ⇒ Object private
-
#initialize(block_context: Block::Context, inspector: Inspector.new, **kwargs) ⇒ Router
constructor
private
A new instance of Router.
-
#to_inspect ⇒ String
private
Returns formatted routes.
- #to_rack_app ⇒ Object private
- #use(middleware, *args, &blk) ⇒ Object private
Constructor Details
#initialize(block_context: Block::Context, inspector: Inspector.new, **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.
17 18 19 20 |
# File 'lib/hanami/api/router.rb', line 17 def initialize(block_context: Block::Context, inspector: Inspector.new, **kwargs) super(block_context: block_context, inspector: inspector, **kwargs) @stack = Middleware::Stack.new(@path_prefix.to_s) end |
Instance Attribute Details
#inspector ⇒ Object (readonly)
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.
13 14 15 |
# File 'lib/hanami/api/router.rb', line 13 def inspector @inspector 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.
24 25 26 27 28 29 |
# File 'lib/hanami/api/router.rb', line 24 def freeze return self if frozen? remove_instance_variable(:@stack) super end |
#to_inspect ⇒ String
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 formatted routes
49 50 51 |
# File 'lib/hanami/api/router.rb', line 49 def to_inspect @inspector.call 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.
39 40 41 |
# File 'lib/hanami/api/router.rb', line 39 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.
33 34 35 |
# File 'lib/hanami/api/router.rb', line 33 def use(middleware, *args, &blk) @stack.use(@path_prefix.to_s, middleware, *args, &blk) end |