Module: Roda::RodaPlugins::BridgetownRoutes::RequestMethods
- Defined in:
- bridgetown-routes/lib/roda/plugins/bridgetown_routes.rb
Instance Method Summary collapse
-
#file_routes ⇒ Object
This runs through all of the routes in the manifest, setting up Roda blocks for execution.
Instance Method Details
#file_routes ⇒ Object
This runs through all of the routes in the manifest, setting up Roda blocks for execution
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'bridgetown-routes/lib/roda/plugins/bridgetown_routes.rb', line 132 def file_routes scope.routes_manifest.routes.each do |route| file, localized_file_slugs, segment_keys = route localized_file_slugs.each do |slug| # This sets up an initial Roda route block at the slug, and handles segments as params # # _routes/nested/[slug].erb -> "nested/:slug" # "nested/123" -> r.params[:slug] == 123 on slug do |*segment_values| segment_values.each_with_index do |value, index| params[segment_keys[index]] ||= value end # This is provided as an instance method by our Roda plugin: scope.run_file_route(file, slug:) end end end nil # be sure not to return the above array loop end |