diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-04-14 16:21:06 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-04-14 16:21:06 -0500 |
commit | c1b4a5eb564f8fdd71307efeb5ee729cc6f20059 (patch) | |
tree | 972bb18da8874a72e815204211093761575a4a62 /actionpack/lib/action_controller | |
parent | 4a3afe0b4f4193d8f35827c5550727f98c6b63e9 (diff) | |
download | rails-c1b4a5eb564f8fdd71307efeb5ee729cc6f20059.tar.gz rails-c1b4a5eb564f8fdd71307efeb5ee729cc6f20059.tar.bz2 rails-c1b4a5eb564f8fdd71307efeb5ee729cc6f20059.zip |
Make dispatcher instances immutable
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/dispatch/dispatcher.rb | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/actionpack/lib/action_controller/dispatch/dispatcher.rb b/actionpack/lib/action_controller/dispatch/dispatcher.rb index 1a923724a1..8ed7de4788 100644 --- a/actionpack/lib/action_controller/dispatch/dispatcher.rb +++ b/actionpack/lib/action_controller/dispatch/dispatcher.rb @@ -66,16 +66,21 @@ module ActionController define_callbacks :prepare_dispatch, :before_dispatch, :after_dispatch def initialize - @app = @@middleware.build(lambda { |env| self.dup._call(env) }) + @app = @@middleware.build(lambda { |env| self._call(env) }) + freeze end - def dispatch + def call(env) + @app.call(env) + end + + def _call(env) begin run_callbacks :before_dispatch - Routing::Routes.call(@env) + Routing::Routes.call(env) rescue Exception => exception if controller ||= (::ApplicationController rescue Base) - controller.call_with_exception(@env, exception).to_a + controller.call_with_exception(env, exception).to_a else raise exception end @@ -84,15 +89,6 @@ module ActionController end end - def call(env) - @app.call(env) - end - - def _call(env) - @env = env - dispatch - end - def flush_logger Base.logger.flush end |