1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/webrick] Document HTTPResponse#body callable option

https://github.com/ruby/webrick/commit/d51836d03d
This commit is contained in:
zverok 2019-10-26 13:27:17 +03:00 committed by Hiroshi SHIBATA
parent ea4272d02b
commit f7cf5416e4

View file

@ -51,8 +51,21 @@ module WEBrick
attr_accessor :reason_phrase
##
# Body may be a String or IO-like object that responds to #read and
# #readpartial.
# Body may be:
# * a String;
# * an IO-like object that responds to +#read+ and +#readpartial+;
# * a Proc-like object that responds to +#call+.
#
# In the latter case, either #chunked= should be set to +true+,
# or <code>header['content-length']</code> explicitly provided.
# Example:
#
# server.mount_proc '/' do |req, res|
# res.chunked = true
# # or
# # res.header['content-length'] = 10
# res.body = proc { |out| out.write(Time.now.to_s) }
# end
attr_accessor :body