| 385 | | routes.each do |route| |
|---|
| 386 | | result = route.recognize(path, environment) and return result |
|---|
| 387 | | end |
|---|
| 388 | | |
|---|
| 389 | | allows = HTTP_METHODS.select { |verb| routes.find { |r| r.recognize(path, :method => verb) } } |
|---|
| 390 | | |
|---|
| 391 | | if environment[:method] && !HTTP_METHODS.include?(environment[:method]) |
|---|
| 392 | | raise NotImplemented.new(*allows) |
|---|
| 393 | | elsif !allows.empty? |
|---|
| 394 | | raise MethodNotAllowed.new(*allows) |
|---|
| 395 | | else |
|---|
| 396 | | raise RoutingError, "No route matches #{path.inspect} with #{environment.inspect}" |
|---|
| 397 | | end |
|---|
| | 385 | raise "Not optimized! Check that routing/recognition_optimisation overrides RouteSet#recognize_path." |
|---|