Class: Hanami::Routes
- Inherits:
-
Object
- Object
- Hanami::Routes
- Defined in:
- lib/hanami/routes.rb
Overview
App routes
Users are expected to inherit from this class to define their app routes.
Defined Under Namespace
Classes: MissingActionError, NotCallableEndpointError
Class Method Summary collapse
- .build_routes(definitions = self.definitions) ⇒ Object private
- .definitions ⇒ Object private
- .routes ⇒ Object private
Class Method Details
.build_routes(definitions = self.definitions) ⇒ 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.
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/hanami/routes.rb', line 70 def build_routes(definitions = self.definitions) return if definitions.empty? proc do definitions.each do |(name, args, kwargs, block)| if block public_send(name, *args, **kwargs, &block) else public_send(name, *args, **kwargs) end end end end |
.definitions ⇒ 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.
85 86 87 |
# File 'lib/hanami/routes.rb', line 85 def definitions @definitions ||= [] end |
.routes ⇒ 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.
64 65 66 |
# File 'lib/hanami/routes.rb', line 64 def self.routes @routes ||= build_routes end |