Module: Roda::RodaPlugins::ClassLevelRouting::InstanceMethods
- Defined in:
- lib/roda/plugins/class_level_routing.rb
Instance Method Summary collapse
-
#call ⇒ Object
If the normal routing tree doesn’t handle an action, try each class level route to see if it matches.
Instance Method Details
#call ⇒ Object
If the normal routing tree doesn’t handle an action, try each class level route to see if it matches.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/roda/plugins/class_level_routing.rb', line 78 def call result = super if result[0] == 404 && (v = result[2]).is_a?(Array) && v.empty? # Reset the response so it doesn't inherit the status or any headers from # the original response. @_response = self.class::RodaResponse.new super do |r| opts[:class_level_routes].each do |meth, args, blk| r.send(meth, *args) do |*a| instance_exec(*a, &blk) end end end else result end end |