22: def initialize(body=[], status=200, header={}, &block)
23: @status = status.to_i
24: @header = Utils::HeaderHash.new({"Content-Type" => "text/html"}.
25: merge(header))
26:
27: @writer = lambda { |x| @body << x }
28: @block = nil
29: @length = 0
30:
31: @body = []
32:
33: if body.respond_to? :to_str
34: write body.to_str
35: elsif body.respond_to?(:each)
36: body.each { |part|
37: write part.to_s
38: }
39: else
40: raise TypeError, "stringable or iterable required"
41: end
42:
43: yield self if block_given?
44: end