Class: ActionController::CgiResponse

Inherits:
AbstractResponse show all
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

Methods inherited from AbstractResponse

#redirect

Constructor Details

#initialize(cgi) ⇒ CgiResponse

Returns a new instance of CgiResponse.



104
105
106
107
# File 'lib/action_controller/cgi_process.rb', line 104

def initialize(cgi)
  @cgi = cgi
  super()
end

Instance Method Details

#outObject



109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/action_controller/cgi_process.rb', line 109

def out
  convert_content_type!(@headers)
  $stdout.binmode if $stdout.respond_to?(:binmode)
  $stdout.sync = false
  print @cgi.header(@headers)

  if @cgi.send(:env_table)['REQUEST_METHOD'] == 'HEAD'
    return
  elsif @body.respond_to?(:call)
    @body.call(self)
  else
    print @body
  end
end