Class: Waves::Response

Inherits:
Object show all
Defined in:
lib/runtime/response.rb

Overview

Waves::Response represents an HTTP response and has methods for constructing a response. These include setters for content_type, content_length, location, and expires headers. You may also set the headers directly using the [] operator. See Rack::Response for documentation of any method not defined here.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Response

Create a new response. Takes the request object. You shouldn’t need to call this directly.



13
14
15
16
# File 'lib/runtime/response.rb', line 13

def initialize( request )
  @request = request
  @response = Rack::Response.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object

Methods not explicitly defined by Waves::Response are delegated to Rack::Response. Check the Rack documentation for more informations



38
39
40
# File 'lib/runtime/response.rb', line 38

def method_missing(name,*args)
  @response.send(name,*args)
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



10
11
12
# File 'lib/runtime/response.rb', line 10

def request
  @request
end

Instance Method Details

#finishObject

Finish the response. This will send the response back to the client, so you shouldn’t attempt to further modify the response once this method is called. You don’t usually need to call it yourself, since it is called by the dispatcher once request processing is finished.



34
# File 'lib/runtime/response.rb', line 34

def finish ;  @response.finish ; end

#rack_responseObject



18
# File 'lib/runtime/response.rb', line 18

def rack_response; @response; end

#sessionObject

Returns the sessions associated with the request, allowing you to set values within it. The session will be created if necessary and saved when the response is complete.



28
# File 'lib/runtime/response.rb', line 28

def session ; request.session ; end