種類
- インスタンスメソッド (231)
- 特異メソッド (66)
- 文書 (33)
- モジュール関数 (22)
ライブラリ
- ビルトイン (198)
- json (11)
-
net
/ http (22) - openssl (11)
- rss (33)
-
rubygems
/ package / tar _ reader / entry (11) -
webrick
/ httpresponse (22) - zlib (11)
クラス
-
ARGF
. class (11) - Array (66)
-
Gem
:: Package :: TarReader :: Entry (11) - IO (77)
-
JSON
:: State (11) -
RSS
:: Maker :: RSS20 :: Items :: Item :: Enclosure (11) -
RSS
:: Rss :: Channel :: Item :: Enclosure (22) - Thread (22)
-
WEBrick
:: HTTPResponse (22) -
Zlib
:: GzipReader (11)
モジュール
- Kernel (22)
-
Net
:: HTTPHeader (22) -
OpenSSL
:: Buffering (11)
キーワード
-
backtrace
_ locations (22) - binread (11)
-
buffer
_ initial _ length= (11) -
caller
_ locations (22) -
content
_ length (22) -
content
_ length= (11) -
copy
_ stream (22) - delete (11)
- fill (66)
- length (11)
- read (88)
-
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 9 feature (11)
検索結果
先頭5件
-
RSS
:: Maker :: RSS20 :: Items :: Item :: Enclosure # length=() (21100.0) -
@todo
@todo -
RSS
:: Rss :: Channel :: Item :: Enclosure # length= (18101.0) -
@todo
@todo -
JSON
:: State # buffer _ initial _ length=(length) (12200.0) -
This sets the initial length of the buffer to length, if length > 0, otherwise its value isn't changed.
...This sets the initial length of the buffer to length, if length > 0,
otherwise its value isn't changed.... -
Array
# fill(start , length = nil) {|index| . . . } -> self (6226.0) -
配列の指定された範囲すべてに val をセットします。
...域を nil で初期化します。
範囲の終点が自身の末尾を越える時は長さを自動的に拡張し、拡張した部分を val で初期化します。
このメソッドが val のコピーでなく val 自身をセットすることに注意してください。
//emlist[例][ru......by]{
a = [0, 1, 2]
a.fill("x", 5..10)
p a #=> [0, 1, 2, nil, nil, "x", "x", "x", "x", "x", "x"]
//}
val の代わりにブロックを指定するとブロックの評価結果を値とし
ます。ブロックは要素毎に実行されるので、セットする値のそれぞれをあ
るオブ......ンデックスが渡されます。
//emlist[例][ruby]{
ary = []
p ary.fill(1..2) {|i| i} # => [nil, 1, 2]
p ary.fill(0,3) {|i| i} # => [0, 1, 2]
p ary.fill { "foo" } # => ["foo", "foo", "foo"]
p ary.collect {|v| v.object_id } # => [537770124, 537770112, 537770100]
//... -
Array
# fill(val , start , length = nil) -> self (6226.0) -
配列の指定された範囲すべてに val をセットします。
...域を nil で初期化します。
範囲の終点が自身の末尾を越える時は長さを自動的に拡張し、拡張した部分を val で初期化します。
このメソッドが val のコピーでなく val 自身をセットすることに注意してください。
//emlist[例][ru......by]{
a = [0, 1, 2]
a.fill("x", 5..10)
p a #=> [0, 1, 2, nil, nil, "x", "x", "x", "x", "x", "x"]
//}
val の代わりにブロックを指定するとブロックの評価結果を値とし
ます。ブロックは要素毎に実行されるので、セットする値のそれぞれをあ
るオブ......ンデックスが渡されます。
//emlist[例][ruby]{
ary = []
p ary.fill(1..2) {|i| i} # => [nil, 1, 2]
p ary.fill(0,3) {|i| i} # => [0, 1, 2]
p ary.fill { "foo" } # => ["foo", "foo", "foo"]
p ary.collect {|v| v.object_id } # => [537770124, 537770112, 537770100]
//... -
IO
. binread(path , length = nil , offset = 0) -> String | nil (6201.0) -
path で指定したファイルを open し、offset の所まで seek し、 length バイト読み込みます。
...SCII-8BIT" です。
//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...\n")
IO.binread("testfile") # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
IO.binread("testfile", 20) # => "This is line......one\nThi"
IO.binread("testfile", 20, 10) # => "ne one\nThis is line "
//}
@see IO.read... -
Kernel
. # caller _ locations(range) -> [Thread :: Backtrace :: Location] | nil (6201.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@pa......。
//emlist[例][ruby]{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []......1, nil)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]
# => [9, 13, 17]
# => ["/Users/user/test.rb", "/Users/user/test.rb", "/Users/user/test.rb"]
test3(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `t... -
Kernel
. # caller _ locations(start = 1 , length = nil) -> [Thread :: Backtrace :: Location] | nil (6201.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@pa......。
//emlist[例][ruby]{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []......1, nil)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]
# => [9, 13, 17]
# => ["/Users/user/test.rb", "/Users/user/test.rb", "/Users/user/test.rb"]
test3(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `t... -
Thread
# backtrace _ locations(range) -> [Thread :: Backtrace :: Location] | nil (6201.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...スレッドの現在のバックトレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します......ernel.#caller_locations と似ていますが、本メソッドは self に限定
した情報を返します。
//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.run
thread.backtrace_locations # => ["/path/to/test.rb:1:in `sleep'", "/path/to/test.rb:1:in `block in <main>'"]
//}
@see Thr......ead::Backtrace::Location... -
Thread
# backtrace _ locations(start = 0 , length = nil) -> [Thread :: Backtrace :: Location] | nil (6201.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...スレッドの現在のバックトレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します......ernel.#caller_locations と似ていますが、本メソッドは self に限定
した情報を返します。
//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.run
thread.backtrace_locations # => ["/path/to/test.rb:1:in `sleep'", "/path/to/test.rb:1:in `block in <main>'"]
//}
@see Thr......ead::Backtrace::Location...