diff options
author | José Valim <jose.valim@gmail.com> | 2010-12-20 12:41:49 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-12-20 12:43:02 +0100 |
commit | 0cbfd6c28d327304432f7d0c067662b5c1e41a78 (patch) | |
tree | 2e727aa29cb08dc70902302b7ab74afd17c4b361 /actionpack/lib | |
parent | e683ab7c390f26e110387822c7ffb5ac6aafebca (diff) | |
download | rails-0cbfd6c28d327304432f7d0c067662b5c1e41a78.tar.gz rails-0cbfd6c28d327304432f7d0c067662b5c1e41a78.tar.bz2 rails-0cbfd6c28d327304432f7d0c067662b5c1e41a78.zip |
Small changes on AD::Reloader.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/reloader.rb | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/reloader.rb b/actionpack/lib/action_dispatch/middleware/reloader.rb index b84410fc62..579b5d8a02 100644 --- a/actionpack/lib/action_dispatch/middleware/reloader.rb +++ b/actionpack/lib/action_dispatch/middleware/reloader.rb @@ -25,26 +25,14 @@ module ActionDispatch # Add a preparation callback. Preparation callbacks are run before each # request. - # - # If a symbol with a block is given, the symbol is used as an identifier. - # That allows to_prepare to be called again with the same identifier to - # replace the existing callback. Passing an identifier is a suggested - # practice if the code adding a preparation block may be reloaded. def self.to_prepare(*args, &block) - first_arg = args.first - if first_arg.is_a?(Symbol) && block_given? - remove_method :"__#{first_arg}" if method_defined?(:"__#{first_arg}") - define_method :"__#{first_arg}", &block - set_callback(:prepare, :"__#{first_arg}") - else - set_callback(:prepare, *args, &block) - end + set_callback(:prepare, *args, &block) end # Add a cleanup callback. Cleanup callbacks are run after each request is # complete (after #close is called on the response body). - def self.to_cleanup(&block) - set_callback(:cleanup, &block) + def self.to_cleanup(*args, &block) + set_callback(:cleanup, *args, &block) end def self.prepare! @@ -55,11 +43,6 @@ module ActionDispatch new(nil).send(:_run_cleanup_callbacks) end - def self.reload! - prepare! - cleanup! - end - def initialize(app) @app = app end |