Sha256: 6804a1ced7f2943d7fcb348cf5810eb12420c7b1b4fb713ac5775a9e46356d7b
Contents?: true
Size: 1.38 KB
Versions: 37
Compression:
Stored size: 1.38 KB
Contents
## RSence # Copyright 2008 Riassence Inc. # http://riassence.com/ # # You should have received a copy of the GNU General Public License along # with this software package. If not, contact licensing@riassence.com ## module RSence # Classic WEBrick -compatible Response object for Rack. # Implements only the methods used by the framework. class Response # Adds the + method "operator" to an extended Array. # Used for pushing http body data. class ResponseBody < Array def +(body_data) self.push(body_data) end end def initialize @body = ResponseBody.new(1) @body[0] = '' @status = 200 @header = { 'Content-Type' => 'text/plain', 'Server' => 'RSence' } end def body=(body_data) @body = ResponseBody.new(1) @body[0] = body_data end def body @body.join end def content_type=(new_content_type) @header['Content-Type'] = new_content_type end def content_type @header['Content-Type'] end def camelize( header_key ) header_key.capitalize.gsub(/\-([a-z])/) { '-'+$1.upcase } end def []=(header_key,header_val) @header[camelize( header_key )] = header_val.to_s end def status=(new_val) @status = new_val.to_i end def status @status end def header @header end end end
Version data entries
37 entries across 37 versions & 2 rubygems