Permalink
Browse files

more block juggling because of rack::mount's fancy hokuspokus

  • Loading branch information...
1 parent 244aa9d commit 68faa25c26bc1a517544fa3a09d7bd8f1329c1d8 Sven Fuchs committed Jul 24, 2010
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/routing_filter/adapters/rails_3.rb
@@ -53,8 +53,15 @@ def optimize_recognize_with_filtering!
alias :optimize_recognize_without_filtering! :optimize_recognize!
alias :optimize_recognize! :optimize_recognize_with_filtering!
+ # note: if you overly and unnecessarily use blocks in your lowlevel libraries you make it fricking
+ # hard for your users to hook in anywhere
def recognize_with_filtering(request, &block)
- filters.run(:around_recognize, request.env['PATH_INFO'], {}, &lambda{ recognize_without_filtering(request, &block) })
+ route, matches, params = nil
+ filters.run(:around_recognize, request.env['PATH_INFO'], {}) do |path, env|
+ recognize_without_filtering(request) { |r, m, p| route, matches, params = r, m, p }
+ params
+ end
+ block.call(route, matches, params)
end
end

0 comments on commit 68faa25

Please sign in to comment.