Class: Lennarb::Routes
- Inherits:
-
Object
- Object
- Lennarb::Routes
- Defined in:
- lib/lennarb/routes.rb
Overview
Routes class for managing application routes
Instance Method Summary collapse
-
#freeze ⇒ self
Freeze the routes to prevent further modification.
-
#frozen? ⇒ Boolean
Check if the routes are frozen.
-
#initialize ⇒ Routes
constructor
Initialize a new Routes instance.
-
#match_route(parts, http_method) ⇒ Array(Proc, Hash)?
Match a route with the given path parts and HTTP method.
-
#root(&block) ⇒ void
Define the root route (GET /).
Constructor Details
Instance Method Details
#freeze ⇒ self
Freeze the routes to prevent further modification
41 42 43 44 45 |
# File 'lib/lennarb/routes.rb', line 41 def freeze @frozen = true @store.freeze self end |
#frozen? ⇒ Boolean
Check if the routes are frozen
50 51 52 |
# File 'lib/lennarb/routes.rb', line 50 def frozen? @frozen end |
#match_route(parts, http_method) ⇒ Array(Proc, Hash)?
Match a route with the given path parts and HTTP method
34 35 36 |
# File 'lib/lennarb/routes.rb', line 34 def match_route(parts, http_method) @store.match_route(parts, http_method) end |
#root(&block) ⇒ void
This method returns an undefined value.
Define the root route (GET /)
25 26 27 |
# File 'lib/lennarb/routes.rb', line 25 def root(&block) get("/", &block) end |