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 76
76:     def finish
77:       @body = block if block_given?
78:       if [204, 304].include?(status.to_i)
79:         header.delete "Content-Type"
80:         [status.to_i, header.to_hash, []]
81:       else
82:         body = @body || []
83:         body = [body] if body.respond_to? :to_str
84:         if body.respond_to?(:to_ary)
85:           header["Content-Length"] = body.to_ary.
86:             inject(0) { |len, part| len + Rack::Utils.bytesize(part) }.to_s
87:         end
88:         [status.to_i, header.to_hash, body]
89:       end
90:     end

[Validate]