Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pushing Buffer up to Live

  • Loading branch information...
commit dd871a3d7277cb6c606ac77187909e7da984c5ca 1 parent c83e147
Aaron Patterson tenderlove authored
Showing with 22 additions and 22 deletions.
  1. +22 −22 actionpack/lib/action_controller/metal/live.rb
44 actionpack/lib/action_controller/metal/live.rb
View
@@ -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 @@ def initialize(status = 200, header = {}, body = [])
private
def build_buffer(response, body)
- buf = Buffer.new response
+ buf = Live::Buffer.new response
body.each { |part| buf.write part }
buf
end
Please sign in to comment.
Something went wrong with that request. Please try again.