96件ヒット
[1-96件を表示]
(0.114秒)
ライブラリ
- ビルトイン (24)
- erb (12)
-
webrick
/ httpresponse (60)
クラス
- ERB (12)
-
WEBrick
:: HTTPResponse (60)
モジュール
- Enumerable (24)
キーワード
- body= (12)
- chunked= (12)
-
content
_ length (12) -
content
_ length= (12) -
def
_ module (12) -
each
_ entry (24) -
to
_ s (12)
検索結果
先頭5件
-
ERB
# def _ module(methodname=& # 39;erb& # 39;) -> Module (13.0) -
変換した Ruby スクリプトをメソッドとして定義した無名のモジュールを返します。
...ッド名
//emlist[例][ruby]{
require 'erb'
filename = 'example.rhtml'
erb = ERB.new("test1<%= arg1 %>\ntest2<%= arg2 %>\n")
erb.filename = filename
MyModule = erb.def_module('render(arg1, arg2)')
class MyClass
include MyModule
end
print MyClass.new.render('foo', 123)
# test1foo
# test2123
//}... -
Enumerable
# each _ entry -> Enumerator (13.0) -
ブロックを各要素に一度ずつ適用します。
...された場合はブロックには配列として渡されます。
//emlist[例][ruby]{
class Foo
include Enumerable
def each
yield 1
yield 1,2
end
end
Foo.new.each_entry{|o| print o, " -- "}
# => 1 -- [1, 2] --
//}
ブロックを省略した場合は Enumerator が返されま... -
Enumerable
# each _ entry {|obj| block} -> self (13.0) -
ブロックを各要素に一度ずつ適用します。
...された場合はブロックには配列として渡されます。
//emlist[例][ruby]{
class Foo
include Enumerable
def each
yield 1
yield 1,2
end
end
Foo.new.each_entry{|o| print o, " -- "}
# => 1 -- [1, 2] --
//}
ブロックを省略した場合は Enumerator が返されま... -
WEBrick
:: HTTPResponse # body=(val) (13.0) -
クライアントに返す内容(エンティティボディ)をセットします。
...適切にチャンク形式エンコーディングされます。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.body = 'hoge'
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 08:... -
WEBrick
:: HTTPResponse # chunked=(flag) (13.0) -
真に設定するとクライアントに返す内容(エンティティボディ)を chunk に分けるようになります。
...ポンスを chunk に分けてクライアントに返します。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.body = 'hoge'
res.chunked = true
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oc... -
WEBrick
:: HTTPResponse # content _ length -> Integer | nil (13.0) -
Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。
...ます。nil を指定することは出来ません。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
f = File.new('testfile')
res.body = f
res.content_length = 2
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive... -
WEBrick
:: HTTPResponse # content _ length=(len) (13.0) -
Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。
...ます。nil を指定することは出来ません。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
f = File.new('testfile')
res.body = f
res.content_length = 2
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive... -
WEBrick
:: HTTPResponse # to _ s -> String (13.0) -
実際にクライアントに送られるデータを文字列として返します。
...クライアントに送られるデータを文字列として返します。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.body = 'hoge'
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 08:...