Parent

Rack::Adapter::Rails::CGIWrapper

Public Class Methods

new(request, response, *args) click to toggle source
     # File lib/rack/adapter/rails.rb, line 93
 93:           def initialize(request, response, *args)
 94:             @request  = request
 95:             @response = response
 96:             @args     = *args
 97:             @input    = request.body
 98: 
 99:             super *args
100:           end

Public Instance Methods

args() click to toggle source

Used to wrap the normal args variable used inside CGI.

     # File lib/rack/adapter/rails.rb, line 159
159:           def args
160:             @args
161:           end
cookies() click to toggle source
     # File lib/rack/adapter/rails.rb, line 150
150:           def cookies
151:             @request.cookies
152:           end
env_table() click to toggle source

Used to wrap the normal env_table variable used inside CGI.

     # File lib/rack/adapter/rails.rb, line 164
164:           def env_table
165:             @request.env
166:           end
header(options = "text/html") click to toggle source
     # File lib/rack/adapter/rails.rb, line 102
102:           def header(options = "text/html")
103:             if options.is_a?(String)
104:               @response['Content-Type']     = options unless @response['Content-Type']
105:             else
106:               @response['Content-Length']   = options.delete('Content-Length').to_s if options['Content-Length']
107:             
108:               @response['Content-Type']     = options.delete('type') || "text/html"
109:               @response['Content-Type']    += "; charset=" + options.delete('charset') if options['charset']
110:                         
111:               @response['Content-Language'] = options.delete('language') if options['language']
112:               @response['Expires']          = options.delete('expires') if options['expires']
113: 
114:               @response.status              = options.delete('Status') if options['Status']
115:               
116:               # Convert 'cookie' header to 'Set-Cookie' headers.
117:               # Because Set-Cookie header can appear more the once in the response body, 
118:               # we store it in a line break seperated string that will be translated to
119:               # multiple Set-Cookie header by the handler.
120:               if cookie = options.delete('cookie')
121:                 cookies = []
122:                 
123:                 case cookie
124:                   when Array then cookie.each { |c| cookies << c.to_s }
125:                   when Hash  then cookie.each { |_, c| cookies << c.to_s }
126:                   else            cookies << cookie.to_s
127:                 end
128:                 
129:                 @output_cookies.each { |c| cookies << c.to_s } if @output_cookies
130:                 
131:                 @response['Set-Cookie'] = [@response['Set-Cookie'], cookies].compact
132:                 # See http://groups.google.com/group/rack-devel/browse_thread/thread/e8759b91a82c5a10/a8dbd4574fe97d69?#a8dbd4574fe97d69
133:                 if Thin.ruby_18?
134:                   @response['Set-Cookie'].flatten!
135:                 else
136:                   @response['Set-Cookie'] = @response['Set-Cookie'].join("\n")
137:                 end
138:               end
139:               
140:               options.each { |k,v| @response[k] = v }
141:             end
142:             
143:             ""
144:           end
params() click to toggle source
     # File lib/rack/adapter/rails.rb, line 146
146:           def params
147:             @params ||= @request.params
148:           end
query_string() click to toggle source
     # File lib/rack/adapter/rails.rb, line 154
154:           def query_string
155:             @request.query_string
156:           end
stdinput() click to toggle source

Used to wrap the normal stdinput variable used inside CGI.

     # File lib/rack/adapter/rails.rb, line 169
169:           def stdinput
170:             @input
171:           end
stdoutput() click to toggle source
     # File lib/rack/adapter/rails.rb, line 173
173:           def stdoutput
174:             STDERR.puts "stdoutput should not be used."
175:             @response.body
176:           end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.