Sha256: 064f9f839104cbf7c7976cce32be8d4cd557d15f0d3b73443a7125c299e9dabd
Contents?: true
Size: 1.02 KB
Versions: 10
Compression:
Stored size: 1.02 KB
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, header = header) header.each do |key, value| self[key] = value end 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
10 entries across 10 versions & 3 rubygems