種類
- インスタンスメソッド (2190)
- 特異メソッド (60)
ライブラリ
- ビルトイン (2214)
- abbrev (12)
- csv (12)
- shellwords (12)
キーワード
- & (12)
- * (24)
- + (12)
- - (12)
- << (12)
- <=> (12)
- == (12)
- [] (48)
- []= (36)
- abbrev (12)
- all? (21)
- any? (30)
- append (8)
- assoc (12)
- at (12)
- bsearch (24)
-
bsearch
_ index (20) - clear (12)
- clone (12)
- collect (24)
- collect! (24)
- combination (24)
- compact (12)
- compact! (12)
- concat (21)
- count (36)
- cycle (24)
- delete (24)
-
delete
_ at (12) -
delete
_ if (24) - difference (7)
- dig (10)
- drop (12)
-
drop
_ while (24) - dup (12)
- each (24)
-
each
_ index (24) - empty? (12)
- eql? (12)
- fetch (36)
- fill (72)
- filter (14)
- filter! (14)
-
find
_ index (36) - first (24)
- flatten (12)
- flatten! (12)
- hash (12)
- include? (12)
- index (36)
- insert (12)
- inspect (12)
- intersect? (4)
- intersection (6)
- join (12)
-
keep
_ if (24) - last (24)
- length (12)
- map (24)
- map! (24)
- max (36)
- min (36)
- minmax (12)
- new (36)
- none? (21)
- one? (21)
- pack (21)
- permutation (24)
- pop (24)
- prepend (8)
- product (24)
- push (12)
- rassoc (12)
- reject (24)
- reject! (24)
-
repeated
_ combination (24) -
repeated
_ permutation (24) - replace (12)
- reverse (12)
- reverse! (12)
-
reverse
_ each (24) - rindex (36)
- rotate (12)
- rotate! (12)
- sample (48)
- select (24)
- select! (24)
- shelljoin (12)
- shift (24)
- shuffle (24)
- shuffle! (24)
- size (12)
- slice (36)
- slice! (36)
- sort (24)
- sort! (24)
-
sort
_ by! (24) - sum (18)
- take (12)
-
take
_ while (24) -
to
_ a (12) -
to
_ ary (12) -
to
_ csv (12) -
to
_ h (19) -
to
_ s (12) - transpose (12)
-
try
_ convert (12) - union (7)
- uniq (24)
- uniq! (24)
- unshift (12)
-
values
_ at (12) - zip (24)
- | (12)
検索結果
先頭5件
-
Array
# repeated _ combination(n) -> Enumerator (9379.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...生成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引......{
a = [1, 2, 3]
a.repeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
a.......して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.repeated_combination(3) {|e| result << e} # => [1,2,3]
result #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
//}
@see Array#repeated_permutation, Array#combination... -
Array
# repeated _ permutation(n) -> Enumerator (9367.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......uby]{
a = [1, 2]
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 #=......ロックを実
行して 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],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}
@see Array#repeated_combination, Array#permutation... -
Array
# repeated _ combination(n) { |c| . . . } -> self (9279.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...生成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引......{
a = [1, 2, 3]
a.repeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
a.......して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.repeated_combination(3) {|e| result << e} # => [1,2,3]
result #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
//}
@see Array#repeated_permutation, Array#combination... -
Array
# repeated _ permutation(n) { |p| . . . } -> self (9267.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......uby]{
a = [1, 2]
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 #=......ロックを実
行して 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],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}
@see Array#repeated_combination, Array#permutation... -
Array
# to _ ary -> self (9107.0) -
self をそのまま返します。
...をそのまま返します。
//emlist[例][ruby]{
class SubArray < Array; end
ary1 = Array([1, 2, 3, 4])
ary2 = SubArray([1, 2, 3, 4])
ary1.to_ary # => [1, 2, 3, 4]
ary1.to_ary.class # => Array
ary2.to_ary # => [1, 2, 3, 4]
ary2.to_ary.class # => SubArray
//}
@see Array#to_a... -
Array
# bsearch -> Enumerator (9101.0) -
ブロックの評価結果で範囲内の各要素の判定を行い、条件を満たす値を二分探 索(計算量は O(log n))で検索します。要素が見つからない場合は nil を返し ます。self はあらかじめソートしておく必要があります。
...メソッドはブロックを評価した結果により以下のいずれかのモードで動作し
ます。
* find-minimum モード
* find-any モード
find-minimum モード(特に理由がない限りはこのモードを使う方がいいでしょ
う)では、条件判定の結果を......の場合: false を返す
ブロックの評価結果が true になる最初の要素を返すか、nil を返します。
//emlist[例][ruby]{
ary = [0, 4, 7, 10, 12]
ary.bsearch {|x| x >= 4 } # => 4
ary.bsearch {|x| x >= 6 } # => 7
ary.bsearch {|x| x >= -1 } # => 0
ary.bsearch {|x| x >= 1......00 } # => nil
//}
find-any モードは bsearch(3) のように動作します。ブロックは真偽値
ではなく、以下のような数値を返す必要があります。求める要素が配列の i 番目
から j-1 番目までに入っているとします。またブロックパラメ......Enumerator のインスタンスを返します。
@raise TypeError ブロックの評価結果が true、false、nil、数値以外であっ
た場合に発生します。
@see Array#bsearch_index, Range#bsearch, https://magazine.rubyist.net/articles/0041/0041-200Special-note.ht... -
Array
# bsearch { |x| . . . } -> object | nil (9101.0) -
ブロックの評価結果で範囲内の各要素の判定を行い、条件を満たす値を二分探 索(計算量は O(log n))で検索します。要素が見つからない場合は nil を返し ます。self はあらかじめソートしておく必要があります。
...メソッドはブロックを評価した結果により以下のいずれかのモードで動作し
ます。
* find-minimum モード
* find-any モード
find-minimum モード(特に理由がない限りはこのモードを使う方がいいでしょ
う)では、条件判定の結果を......の場合: false を返す
ブロックの評価結果が true になる最初の要素を返すか、nil を返します。
//emlist[例][ruby]{
ary = [0, 4, 7, 10, 12]
ary.bsearch {|x| x >= 4 } # => 4
ary.bsearch {|x| x >= 6 } # => 7
ary.bsearch {|x| x >= -1 } # => 0
ary.bsearch {|x| x >= 1......00 } # => nil
//}
find-any モードは bsearch(3) のように動作します。ブロックは真偽値
ではなく、以下のような数値を返す必要があります。求める要素が配列の i 番目
から j-1 番目までに入っているとします。またブロックパラメ......Enumerator のインスタンスを返します。
@raise TypeError ブロックの評価結果が true、false、nil、数値以外であっ
た場合に発生します。
@see Array#bsearch_index, Range#bsearch, https://magazine.rubyist.net/articles/0041/0041-200Special-note.ht... -
Array
# bsearch _ index -> Enumerator (9101.0) -
ブロックの評価結果で範囲内の各要素の判定を行い、条件を満たす値の位置を 二分探索(計算量は O(log n))で検索します。要素が見つからない場合は nil を返します。self はあらかじめソートしておく必要があります。
...ソッドはArray#bsearchと同様に、ブロックを評価した結果により2
つのモードで動作します。Array#bsearch との違いは見つかった要素自
身を返すか位置を返すかのみです。各モードのより詳細な違いについては
Array#bsearch を参照し......ind-minimum モード][ruby]{
ary = [0, 4, 7, 10, 12]
ary.bsearch_index { |x| x >= 4 } # => 1
ary.bsearch_index { |x| x >= 6 } # => 2
ary.bsearch_index { |x| x >= -1 } # => 0
ary.bsearch_index { |x| x >= 100 } # => nil
//}
//emlist[例: find-any モード][ruby]{
ary = [0, 4, 7, 10, 12]
# 4 <=......v < 8 になる要素の位置を検索
ary.bsearch_index { |x| 1 - x / 4 } # => 2
# 8 <= v < 10 になる要素の位置を検索
ary.bsearch_index { |x| 4 - x / 2 } # => nil
//}
@see Array#bsearch... -
Array
# bsearch _ index { |x| . . . } -> Integer | nil (9101.0) -
ブロックの評価結果で範囲内の各要素の判定を行い、条件を満たす値の位置を 二分探索(計算量は O(log n))で検索します。要素が見つからない場合は nil を返します。self はあらかじめソートしておく必要があります。
...ソッドはArray#bsearchと同様に、ブロックを評価した結果により2
つのモードで動作します。Array#bsearch との違いは見つかった要素自
身を返すか位置を返すかのみです。各モードのより詳細な違いについては
Array#bsearch を参照し......ind-minimum モード][ruby]{
ary = [0, 4, 7, 10, 12]
ary.bsearch_index { |x| x >= 4 } # => 1
ary.bsearch_index { |x| x >= 6 } # => 2
ary.bsearch_index { |x| x >= -1 } # => 0
ary.bsearch_index { |x| x >= 100 } # => nil
//}
//emlist[例: find-any モード][ruby]{
ary = [0, 4, 7, 10, 12]
# 4 <=......v < 8 になる要素の位置を検索
ary.bsearch_index { |x| 1 - x / 4 } # => 2
# 8 <= v < 10 になる要素の位置を検索
ary.bsearch_index { |x| 4 - x / 2 } # => nil
//}
@see Array#bsearch...