class Wunderbar::RackApp
Public Instance Methods
call(env)
click to toggle source
entry point for Rack
# File lib/wunderbar/rack.rb, line 8 def call(env) @_env = env @_request = Rack::Request.new(env) @_response = Rack::Response.new Wunderbar.logger = @_request.logger file = Wunderbar.files[env['PATH_INFO']] if file mime = file[:mime] || Rack::Mime::MIME_TYPES[File.extname(env['PATH_INFO'])] @_response.set_header('Content-Type', mime) if mime @_response.write(file[:content] || file[:source].call) else Wunderbar::CGI.call(self) end @_response.finish end
env()
click to toggle source
# File lib/wunderbar/rack.rb, line 37 def env @_env end
out(headers,&block)
click to toggle source
redirect the output produced
# File lib/wunderbar/rack.rb, line 27 def out(headers,&block) status = headers.delete('status') @_response.status = status if status headers = Wunderbar::CGI.headers(headers) headers.each {|key, value| @_response[key] = value} @_response.write block.call unless @_request.head? end
params()
click to toggle source
# File lib/wunderbar/rack.rb, line 41 def params @_request.params end
request()
click to toggle source
# File lib/wunderbar/rack.rb, line 45 def request @_request end
response()
click to toggle source
# File lib/wunderbar/rack.rb, line 49 def response @_response end