/usr/lib/ruby/1.9.1/ramaze/response.rb is in libramaze-ruby1.9.1 2010.06.18-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # Copyright (c) 2009 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
# Alias for Current.response
def self.current; Current.response; end
def initialize(body = [], status = 200, header = {}, &block)
modified_header = Ramaze.options.header.merge(header)
header.merge!(modified_header)
super
end
# Build/replace this responses data
def build(new_body = nil, new_status = nil, new_header = nil)
self.header.merge!(new_header) if new_header
self.body = new_body if new_body
self.status = new_status if new_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
|