Sha256: 9a30969f9c4512999056b64407ca9c1277368c1953853335c9317190ea642535
Contents?: true
Size: 1.38 KB
Versions: 4
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 # Simply 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 # Classic WEBrick -compatible Response object for Rack. # Implements only the methods used by the framework. class Response 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rsence-2.0.0.10.pre | lib/http/response.rb |
rsence-2.0.0.9.pre | lib/http/response.rb |
rsence-2.0.0.8.pre | lib/http/response.rb |
rsence-2.0.0.7.pre | lib/http/response.rb |