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, RoutesProc
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.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/hanami/routes.rb', line 99 def build_routes(definitions = self.definitions) return RoutesProc.empty if definitions.empty? routes_proc = 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 RoutesProc.new(routes_proc) 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.
116 117 118 |
# File 'lib/hanami/routes.rb', line 116 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.
93 94 95 |
# File 'lib/hanami/routes.rb', line 93 def self.routes @routes ||= build_routes end |