Class: ActionController::CgiResponse
- Inherits:
-
AbstractResponse
- Object
- AbstractResponse
- ActionController::CgiResponse
- Defined in:
- lib/action_controller/cgi_process.rb
Overview
:nodoc:
Constant Summary
Constants inherited from AbstractResponse
AbstractResponse::DEFAULT_HEADERS
Instance Attribute Summary
Attributes inherited from AbstractResponse
#assigns, #body, #cookies, #headers, #redirected_to, #redirected_to_method_params, #session, #template
Instance Method Summary collapse
-
#initialize(cgi) ⇒ CgiResponse
constructor
A new instance of CgiResponse.
- #out(output = $stdout) ⇒ Object
Methods inherited from AbstractResponse
Constructor Details
#initialize(cgi) ⇒ CgiResponse
Returns a new instance of CgiResponse.
157 158 159 160 |
# File 'lib/action_controller/cgi_process.rb', line 157 def initialize(cgi) @cgi = cgi super() end |
Instance Method Details
#out(output = $stdout) ⇒ Object
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/action_controller/cgi_process.rb', line 162 def out(output = $stdout) convert_content_type!(@headers) output.binmode if output.respond_to?(:binmode) output.sync = false if output.respond_to?(:sync=) begin output.write(@cgi.header(@headers)) if @cgi.send(:env_table)['REQUEST_METHOD'] == 'HEAD' return elsif @body.respond_to?(:call) @body.call(self, output) else output.write(@body) end output.flush if output.respond_to?(:flush) rescue Errno::EPIPE => e # lost connection to the FCGI process -- ignore the output, then end end |