diff options
author | Sergey Nartimov <just.lest@gmail.com> | 2012-01-16 14:35:44 +0300 |
---|---|---|
committer | Sergey Nartimov <just.lest@gmail.com> | 2012-01-16 14:35:44 +0300 |
commit | 3ded9b3c26e7fc2684ba1200ae9263d821408545 (patch) | |
tree | 0e69d888e5510bc240ec02b7b708645f20d1688b /actionpack | |
parent | f9f0f03822b4ead1a9b6fd9f314e363c65fb63e8 (diff) | |
download | rails-3ded9b3c26e7fc2684ba1200ae9263d821408545.tar.gz rails-3ded9b3c26e7fc2684ba1200ae9263d821408545.tar.bz2 rails-3ded9b3c26e7fc2684ba1200ae9263d821408545.zip |
use Rack::BodyProxy in AD::Reloader
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/body_proxy.rb | 30 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/reloader.rb | 6 |
2 files changed, 3 insertions, 33 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/body_proxy.rb b/actionpack/lib/action_dispatch/middleware/body_proxy.rb deleted file mode 100644 index 739b9e427a..0000000000 --- a/actionpack/lib/action_dispatch/middleware/body_proxy.rb +++ /dev/null @@ -1,30 +0,0 @@ -# Keep this file meanwhile https://github.com/rack/rack/pull/313 is not released -module ActionDispatch - class BodyProxy - def initialize(body, &block) - @body, @block, @closed = body, block, false - end - - def respond_to?(*args) - super or @body.respond_to?(*args) - end - - def close - return if @closed - @closed = true - begin - @body.close if @body.respond_to? :close - ensure - @block.call - end - end - - def closed? - @closed - end - - def method_missing(*args, &block) - @body.__send__(*args, &block) - end - end -end diff --git a/actionpack/lib/action_dispatch/middleware/reloader.rb b/actionpack/lib/action_dispatch/middleware/reloader.rb index 7a5aff214d..a0388e0e13 100644 --- a/actionpack/lib/action_dispatch/middleware/reloader.rb +++ b/actionpack/lib/action_dispatch/middleware/reloader.rb @@ -1,5 +1,3 @@ -require 'action_dispatch/middleware/body_proxy' - module ActionDispatch # ActionDispatch::Reloader provides prepare and cleanup callbacks, # intended to assist with code reloading during development. @@ -62,8 +60,10 @@ module ActionDispatch def call(env) @validated = @condition.call prepare! + response = @app.call(env) - response[2] = ActionDispatch::BodyProxy.new(response[2]) { cleanup! } + response[2] = ::Rack::BodyProxy.new(response[2]) { cleanup! } + response rescue Exception cleanup! |