# File lib/routing_filter/adapters/rails_2.rb, line 13
  def generate_optimisation_block_with_filtering(*args)
    code = generate_optimisation_block_without_filtering(*args)
    if match = code.match(%r(^return (.*) if (.*)))
      # returned string must not contain newlines, or we'll spill out of inline code comments in
      # ActionController::Routing::RouteSet::NamedRouteCollection#define_url_helper
      "returning(#{match[1]}) { |result|" +
      "  ActionController::Routing::Routes.filters.run(:around_generate, *args, &lambda{ result }) " +
      "} if #{match[2]}"
    end
  end