Sha256: 6d278e82ad94c42bc2f97000c44dc0ef336a8e7c92a182b7f32b2517de718ea9

Contents?: true

Size: 775 Bytes

Versions: 9

Compression:

Stored size: 775 Bytes

Contents

module Wunderbar
  class RackApp
    # entry point for Rack
    def call(env)
      @_env = env
      @_request = Rack::Request.new(env)
      @_response = Rack::Response.new
      Wunderbar.logger = @_request.logger
      Wunderbar::CGI.call(self)
      @_response.finish
    end

    # redirect the output produced
    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

    def env
      @_env
    end

    def params
      @_request.params
    end

    def request
      @_request
    end

    def response
      @_response
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
wunderbar-0.10.9 lib/wunderbar/rack.rb
wunderbar-0.10.8 lib/wunderbar/rack.rb
wunderbar-0.10.7 lib/wunderbar/rack.rb
wunderbar-0.10.6 lib/wunderbar/rack.rb
wunderbar-0.10.5 lib/wunderbar/rack.rb
wunderbar-0.10.4 lib/wunderbar/rack.rb
wunderbar-0.10.3 lib/wunderbar/rack.rb
wunderbar-0.10.2 lib/wunderbar/rack.rb
wunderbar-0.10.1 lib/wunderbar/rack.rb