621件ヒット
[1-100件を表示]
(0.113秒)
種類
- インスタンスメソッド (467)
- 特異メソッド (77)
- モジュール関数 (55)
- クラス (22)
モジュール
- Enumerable (113)
- Kernel (55)
キーワード
- IO (11)
- Numeric (11)
- [] (44)
- []= (33)
- binread (11)
- bytesplice (4)
- caller (33)
-
caller
_ locations (22) - chunk (11)
-
chunk
_ while (11) -
copy
_ stream (22) - empty? (11)
- fill (66)
-
max
_ by (44) - none? (13)
- one? (13)
- permutation (22)
- read (44)
-
repeated
_ combination (22) -
repeated
_ permutation (22) - sample (44)
- size (33)
-
slice
_ before (22) -
slice
_ when (11) - sum (8)
- truncate (11)
検索結果
先頭5件
-
Array
# length -> Integer (18109.0) -
配列の長さを返します。配列が空のときは 0 を返します。
...配列の長さを返します。配列が空のときは 0 を返します。
//emlist[例][ruby]{
p [1, nil, 3, nil].size #=> 4
//}... -
MatchData
# length -> Integer (18109.0) -
部分文字列の数を返します(self.to_a.size と同じです)。
...部分文字列の数を返します(self.to_a.size と同じです)。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.size # => 4
//}... -
Array
# repeated _ permutation(n) -> Enumerator (12209.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=> [[]] # one perm......utation of length 0
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1... -
Array
# repeated _ permutation(n) { |p| . . . } -> self (12209.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=> [[]] # one perm......utation of length 0
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1... -
IO
. copy _ stream(src , dst , copy _ length = nil) -> Integer (6316.0) -
指定された src から dst へコピーします。 コピーしたバイト数を返します。
...src のオフセット(src.pos)は変更されません。
@param src コピー元となる IO オブジェクトかファイル名を指定します。
@param dst コピー先となる IO オブジェクトかファイル名を指定します。
@param copy_length コピーする長さをバイ......copy_length までコピーされます。
nil を指定した場合、コピーする長さに制限はありません。
@param src_offset コピーを始めるオフセットを数値で指定します。
//emlist[例][ruby]{
IO.write("filetest", "abcdefghij")
IO.copy_strea......m("filetest", "filecopy", 2) # => 2
IO.read("filecopy") # => "ab"
IO.copy_stream("filetest", "filecopy", 3, 4) # => 3
IO.read("filecopy") # => "efg"
//}... -
IO
. copy _ stream(src , dst , copy _ length , src _ offset) -> Integer (6316.0) -
指定された src から dst へコピーします。 コピーしたバイト数を返します。
...src のオフセット(src.pos)は変更されません。
@param src コピー元となる IO オブジェクトかファイル名を指定します。
@param dst コピー先となる IO オブジェクトかファイル名を指定します。
@param copy_length コピーする長さをバイ......copy_length までコピーされます。
nil を指定した場合、コピーする長さに制限はありません。
@param src_offset コピーを始めるオフセットを数値で指定します。
//emlist[例][ruby]{
IO.write("filetest", "abcdefghij")
IO.copy_strea......m("filetest", "filecopy", 2) # => 2
IO.read("filecopy") # => "ab"
IO.copy_stream("filetest", "filecopy", 3, 4) # => 3
IO.read("filecopy") # => "efg"
//}... -
Array
# permutation(n = self . length) -> Enumerator (6217.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(0).to_a #=> [[]]: one per......mutation of length 0
a.permutation(4).to_a #=> [] : no permutations of length 4
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e| res... -
Array
# permutation(n = self . length) { |p| block } -> self (6217.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(0).to_a #=> [[]]: one per......mutation of length 0
a.permutation(4).to_a #=> [] : no permutations of length 4
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e| res... -
String
# bytesplice(index , length , str) -> String (6215.0) -
self の一部または全部を str で置き換えて str を返します。
...に長さが調整されます。
@param index 置換したい文字列の範囲の始端
@param length 置換したい文字列の範囲の長さ
@param range 置換したい文字列の範囲を示す Range オブジェクト
@raise IndexError index や length が範囲外の場合に発生
@rais... -
Array
# sample -> object | nil (6132.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...場合は nil を、個数を指定した場合は空配列を返します。
srand()が有効です。
@param n 取得する要素の数を指定します。自身の要素数(self.length)以上の
値を指定した場合は要素数と同じ数の配列を返します。
整......数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@param random 乱数生成器(主に Random オブジェクト)を指定します。
選択する要素のインデックスを返す rand メソッドに......peError 引数 n に整数以外の(暗黙の型変換が行えない)オブジェク
トを指定した場合に発生します。
@raise ArgumentError 引数 n に負の数を指定した場合に発生します。
//emlist[例][ruby]{
a = (1..10).to_a
p a.sample #=> 9
p...