Class: ActionController::Live::Buffer
- Inherits:
-
ActionDispatch::Response::Buffer
- Object
- ActionDispatch::Response::Buffer
- ActionController::Live::Buffer
- Defined in:
- actionpack/lib/action_controller/metal/live.rb
Overview
:nodoc:
Instance Method Summary collapse
- #call_on_error ⇒ Object
- #close ⇒ Object
- #each ⇒ Object
-
#initialize(response) ⇒ Buffer
constructor
A new instance of Buffer.
- #on_error(&block) ⇒ Object
- #write(string) ⇒ Object
Methods inherited from ActionDispatch::Response::Buffer
Constructor Details
#initialize(response) ⇒ Buffer
Returns a new instance of Buffer.
36 37 38 39 |
# File 'actionpack/lib/action_controller/metal/live.rb', line 36 def initialize(response) @error_callback = nil super(response, SizedQueue.new(10)) end |
Instance Method Details
#call_on_error ⇒ Object
65 66 67 |
# File 'actionpack/lib/action_controller/metal/live.rb', line 65 def call_on_error @error_callback.call end |
#close ⇒ Object
56 57 58 59 |
# File 'actionpack/lib/action_controller/metal/live.rb', line 56 def close super @buf.push nil end |
#each ⇒ Object
50 51 52 53 54 |
# File 'actionpack/lib/action_controller/metal/live.rb', line 50 def each while str = @buf.pop yield str end end |
#on_error(&block) ⇒ Object
61 62 63 |
# File 'actionpack/lib/action_controller/metal/live.rb', line 61 def on_error(&block) @error_callback = block end |
#write(string) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'actionpack/lib/action_controller/metal/live.rb', line 41 def write(string) unless @response.committed? @response.headers["Cache-Control"] = "no-cache" @response.headers.delete "Content-Length" end super end |