after_middles plugin: opinions sought

Hi --

I'm curious what people here on ruby-core think of this plugin:

git://github.com/dblack/after_middles.git

It provides (somewhat rudimentary) Rack-based after_filter-like functionality, so you can do things like:

   class MyMiddleware      def call        ...      end    end

   ...

   class MyController < ActionController      after_middle MyMiddleware, :only => "show"    end

I'm working on it partly just for my own education as to the middleware integration and its implementation, but also hoping it will be useful and/or a speed gain, on a per-action basis. I'd love to get some feedback.

David

Really cool man.

I was looking for a way to allow sessions per controller or something like that. I think this would definitely work.

Controller classes should be thought of as a "rack app" `PeopleController.call(env)`

If you want to do per action, I'm working on pushing the env["rack.routing_args"] spec/convention. So env["rack.routing_args"]["action"] should be a standard way of retrieving that.

Please continue to play with this, I really like it and it would be cool to include in 2.3 if you think the API is solid.

Just a thought, why not just bake this into the around_filter spec.

  around_filter SomeMiddleware

Hi --

Really cool man.

I was looking for a way to allow sessions per controller or something like that. I think this would definitely work.

Controller classes should be thought of as a "rack app" `PeopleController.call(env)`

If you want to do per action, I'm working on pushing the env["rack.routing_args"] spec/convention. So env["rack.routing_args"]["action"] should be a standard way of retrieving that.

Please continue to play with this, I really like it and it would be cool to include in 2.3 if you think the API is solid.

Thanks. I'll definitely keep at it.

To answer the question in your second reply, about baking it into around_filter: I've kept it separate from the existing filter and callback mechanism (except that after_middle is implemented with before_filter), partly in the hope that as a separate mini-filter system it might be lighter-weight and faster. But I don't know whether that's realistic, nor whether it's worth introducing extra framework constructs.

David