diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-07-29 19:34:59 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-07-29 21:43:06 -0700 |
commit | dd871a3d7277cb6c606ac77187909e7da984c5ca (patch) | |
tree | 75f2f9d7feff65167f0690ad161c8a6a6df09298 | |
parent | c83e147e47ded37116cbfa8d3612019e7603fd82 (diff) | |
download | rails-dd871a3d7277cb6c606ac77187909e7da984c5ca.tar.gz rails-dd871a3d7277cb6c606ac77187909e7da984c5ca.tar.bz2 rails-dd871a3d7277cb6c606ac77187909e7da984c5ca.zip |
pushing Buffer up to Live
-rw-r--r-- | actionpack/lib/action_controller/metal/live.rb | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/actionpack/lib/action_controller/metal/live.rb b/actionpack/lib/action_controller/metal/live.rb index 03f9cd6d58..b0fe0d80ab 100644 --- a/actionpack/lib/action_controller/metal/live.rb +++ b/actionpack/lib/action_controller/metal/live.rb @@ -28,34 +28,34 @@ module ActionController # :nodoc: # the main thread. Make sure your actions are thread safe, and this shouldn't # be a problem (don't share state across threads, etc). module Live - class Response < ActionDispatch::Response - class Buffer < ActionDispatch::Response::Buffer # :nodoc: - def initialize(response) - super(response, Queue.new) - end - - def write(string) - unless @response.committed? - @response.headers["Cache-Control"] = "no-cache" - @response.headers.delete("Content-Length") - end + class Buffer < ActionDispatch::Response::Buffer # :nodoc: + def initialize(response) + super(response, Queue.new) + end - super + def write(string) + unless @response.committed? + @response.headers["Cache-Control"] = "no-cache" + @response.headers.delete("Content-Length") end - def each - while str = @buf.pop - yield str - end - end + super + end - def close - super - @buf.push nil + def each + while str = @buf.pop + yield str end end - class Header < DelegateClass(Hash) + def close + super + @buf.push nil + end + end + + class Response < ActionDispatch::Response # :nodoc: + class Header < DelegateClass(Hash) # :nodoc: def initialize(response, header) @response = response super(header) @@ -78,7 +78,7 @@ module ActionController # :nodoc: private def build_buffer(response, body) - buf = Buffer.new response + buf = Live::Buffer.new response body.each { |part| buf.write part } buf end |