ライブラリ
- ビルトイン (1961)
- abbrev (11)
- csv (11)
- shellwords (11)
キーワード
- & (11)
- * (22)
- + (11)
- - (11)
- << (11)
- <=> (11)
- == (11)
- [] (33)
- []= (33)
- abbrev (11)
- all? (18)
- any? (27)
- append (7)
- assoc (11)
- at (11)
- bsearch (22)
-
bsearch
_ index (18) - clear (11)
- clone (11)
- collect (22)
- collect! (22)
- combination (22)
- compact (11)
- compact! (11)
- concat (19)
- count (33)
- cycle (22)
- delete (22)
-
delete
_ at (11) -
delete
_ if (22) - difference (6)
- dig (9)
- drop (11)
-
drop
_ while (22) - dup (11)
- each (22)
-
each
_ index (22) - empty? (11)
- eql? (11)
- fetch (33)
- fill (66)
- filter (12)
- filter! (12)
-
find
_ index (33) - first (22)
- flatten (11)
- flatten! (11)
- hash (11)
- include? (11)
- index (33)
- insert (11)
- inspect (11)
- intersect? (3)
- intersection (5)
- join (11)
-
keep
_ if (22) - last (22)
- length (11)
- map (22)
- map! (22)
- max (32)
- min (32)
- minmax (10)
- none? (18)
- one? (18)
- pack (19)
- permutation (22)
- pop (22)
- prepend (7)
- product (22)
- push (11)
- rassoc (11)
- reject (22)
- reject! (22)
-
repeated
_ combination (22) -
repeated
_ permutation (22) - replace (11)
- reverse (11)
- reverse! (11)
-
reverse
_ each (22) - rindex (33)
- rotate (11)
- rotate! (11)
- sample (44)
- select (22)
- select! (22)
- shelljoin (11)
- shift (22)
- shuffle (22)
- shuffle! (22)
- size (11)
- slice (33)
- slice! (33)
- sort (22)
- sort! (22)
-
sort
_ by! (22) - sum (16)
- take (11)
-
take
_ while (22) -
to
_ a (11) -
to
_ ary (11) -
to
_ csv (11) -
to
_ h (17) -
to
_ s (11) - transpose (11)
- union (6)
- uniq (22)
- uniq! (22)
- unshift (11)
-
values
_ at (11) - zip (22)
- | (11)
検索結果
先頭5件
-
Array
# reject! {|x| . . . } -> self | nil (2.0) -
要素を順番にブロックに渡して評価し、その結果が真になった要素をすべて削除します。 delete_if は常に self を返しますが、reject! は要素が 1 つ以上削除されれば self を、 1 つも削除されなければ nil を返します。
...い。
//emlist[例][ruby]{
a = [0, 1, 2, 3, 4, 5]
a.delete_if{|x| x % 2 == 0}
p a #=> [1, 3, 5]
a = [0, 1, 2, 3, 4, 5]
e = a.reject!
e.each{|i| i % 2 == 0}
p a #=> [1, 3, 5] もとの配列から削除されていることに注意。
//}
@see Array#select!, Array#keep_if... -
Array
# repeated _ combination(n) -> Enumerator (2.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...して 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 _ combination(n) { |c| . . . } -> self (2.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...して 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 (2.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...ロックを実
行して 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 _ permutation(n) { |p| . . . } -> self (2.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...ロックを実
行して 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
# replace(another) -> self (2.0) -
配列の内容を配列 another の内容で置き換えます。
配列の内容を配列 another の内容で置き換えます。
@param another 配列を指定します。
配列以外のオブジェクトを指定した場合は to_ary メソッドに
よる暗黙の型変換を試みます。
@raise TypeError 引数に配列以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
a = [1, 2, 3]
a.replace [4, 5, 6]
p a #=> [4, 5, 6]
... -
Array
# reverse -> Array (2.0) -
reverse は自身の要素を逆順に並べた新しい配列を生成して返します。 reverse! は自身を破壊的に並べ替えます。 reverse! は self を返します。
reverse は自身の要素を逆順に並べた新しい配列を生成して返します。
reverse! は自身を破壊的に並べ替えます。
reverse! は self を返します。
//emlist[例][ruby]{
a = ["a", 2, true]
p a.reverse #=> [true, 2, "a"]
p a #=> ["a", 2, true] (変化なし)
a = ["a", 2, true]
p a.reverse! #=> [true, 2, "a"]
p a #=> [true, ... -
Array
# reverse! -> self (2.0) -
reverse は自身の要素を逆順に並べた新しい配列を生成して返します。 reverse! は自身を破壊的に並べ替えます。 reverse! は self を返します。
reverse は自身の要素を逆順に並べた新しい配列を生成して返します。
reverse! は自身を破壊的に並べ替えます。
reverse! は self を返します。
//emlist[例][ruby]{
a = ["a", 2, true]
p a.reverse #=> [true, 2, "a"]
p a #=> ["a", 2, true] (変化なし)
a = ["a", 2, true]
p a.reverse! #=> [true, 2, "a"]
p a #=> [true, ... -
Array
# reverse _ each -> Enumerator (2.0) -
各要素に対して逆順にブロックを評価します。
...て逆順にブロックを評価します。
ブロックが与えられなかった場合は、自身と reverse_each から生成した
Enumerator オブジェクトを返します。
//emlist[例][ruby]{
a = [ "a", "b", "c" ]
a.reverse_each {|x| print x, " " }
# => c b a
//}
@see Array#each... -
Array
# reverse _ each {|item| . . . } -> self (2.0) -
各要素に対して逆順にブロックを評価します。
...て逆順にブロックを評価します。
ブロックが与えられなかった場合は、自身と reverse_each から生成した
Enumerator オブジェクトを返します。
//emlist[例][ruby]{
a = [ "a", "b", "c" ]
a.reverse_each {|x| print x, " " }
# => c b a
//}
@see Array#each...