るりまサーチ

最速Rubyリファレンスマニュアル検索!
96件ヒット [1-96件を表示] (0.114秒)

別のキーワード

  1. _builtin include?
  2. socket mcast_include
  3. dbm include?
  4. gdbm include?
  5. sdbm include?

ライブラリ

クラス

モジュール

キーワード

検索結果

ERB#def_module(methodname='erb') -> 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:...