Sha256: 68b7146df4b9996f49e5f4f966a4a8f66e4a8ecc56cfe0dbee068985abd66190
Contents?: true
Size: 1011 Bytes
Versions: 4
Compression:
Stored size: 1011 Bytes
Contents
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com # All files in this distribution are subject to the terms of the Ruby license. module Ramaze class Response < Rack::Response class << self # Alias for Current::response def current() Current.response end end def initialize(body = [], status = 200, header = {}, &block) header['Content-Type'] ||= Global.content_type header['Accept-Charset'] = Global.accept_charset if Global.accept_charset super end # Build/replace this responses data def build(new_body = body, status = status, new_header = {}) self.header.merge!(new_header) self.body, self.status = new_body, status end def body=(obj) if obj.respond_to?(:stat) @length = obj.stat.size @body = obj elsif obj.respond_to?(:size) @body = [] @length = 0 write(obj) else raise(ArgumentError, "Invalid body: %p" % obj) end end end end
Version data entries
4 entries across 4 versions & 3 rubygems