Class Sinatra::Response
In: lib/sinatra/base.rb
Parent: Rack::Response

The response object. See Rack::Response and Rack::ResponseHelpers for more info: rack.rubyforge.org/doc/classes/Rack/Response.html rack.rubyforge.org/doc/classes/Rack/Response/Helpers.html

Methods

finish  

Public Instance methods

[Source]

    # File lib/sinatra/base.rb, line 36
36:     def finish
37:       @body = block if block_given?
38:       if [204, 304].include?(status.to_i)
39:         header.delete "Content-Type"
40:         [status.to_i, header.to_hash, []]
41:       else
42:         body = @body || []
43:         body = [body] if body.respond_to? :to_str
44:         if body.respond_to?(:to_ary)
45:           header["Content-Length"] = body.to_ary.
46:             inject(0) { |len, part| len + part.bytesize }.to_s
47:         end
48:         [status.to_i, header.to_hash, body]
49:       end
50:     end

[Validate]