Parent

Class Index [+]

Quicksearch

Ramaze::Response

Ramaze::Response is a small wrapper around Rack::Response that makes it easier to send response data to the browser from a Ramaze application.

@author Michael Fellinger @since 01-03-2008

Public Class Methods

current() click to toggle source

Alias for Current.response

    # File lib/ramaze/response.rb, line 13
13:     def self.current; Current.response; end
new(body = [], status = 200, header = {}, &block) click to toggle source

Creates a new instance of the response class and processes the specified parameters. Once this has been done it calls Rack::Response#initialize.

@author Michael Fellinger @since 01-03-2008 @param [Array] body An array containing the data for the response body. @param [Fixnum] status The HTPP status code for the response. @param [Hash] header A hash containing additional headers and their

 values.

@param [Proc] &block

    # File lib/ramaze/response.rb, line 27
27:     def initialize(body = [], status = 200, header = {}, &block)
28:       modified_header = Ramaze.options.header.merge(header)
29:       header.merge!(modified_header)
30:       super
31:     end

Public Instance Methods

body=(obj) click to toggle source

Sets the body of the response to the given object.

@author Michael Fellinger @since 01-03-2008 @param [Object] obj The object to use as the response body.

    # File lib/ramaze/response.rb, line 54
54:     def body=(obj)
55:       if obj.respond_to?(:stat)
56:         @length = obj.stat.size
57:         @body   = obj
58:       elsif obj.respond_to?(:size)
59:         @body   = []
60:         @length = 0
61:         write(obj)
62:       else
63:         raise(ArgumentError, "Invalid body: %p" % obj)
64:       end
65:     end
build(new_body = nil, new_status = nil, new_header = nil) click to toggle source

Updates the body, status and headers.

@author Michael Fellinger @since 01-03-2008 @see Ramaze::Response#initialize

    # File lib/ramaze/response.rb, line 40
40:     def build(new_body = nil, new_status = nil, new_header = nil)
41:       self.header.merge!(new_header) if new_header
42: 
43:       self.body   = new_body   if new_body
44:       self.status = new_status if new_status
45:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.