1004件ヒット
[201-300件を表示]
(0.056秒)
別のキーワード
キーワード
- & (12)
- << (12)
- abbrev (12)
- append (8)
- bsearch (24)
-
bsearch
_ index (20) - clear (12)
- collect! (24)
- combination (24)
- compact (12)
- compact! (12)
- concat (21)
-
delete
_ if (24) - difference (7)
- dig (10)
- each (24)
-
each
_ index (24) -
fetch
_ values (2) - fill (72)
- filter! (14)
- flatten (12)
- flatten! (12)
- insert (12)
-
keep
_ if (24) - map! (24)
- permutation (24)
- prepend (8)
- product (24)
- push (12)
- reject! (24)
-
repeated
_ combination (24) -
repeated
_ permutation (24) - replace (12)
- reverse (12)
- reverse! (12)
-
reverse
_ each (24) - rotate! (12)
- sample (48)
- select! (24)
- shuffle! (24)
- sort (24)
- sort! (24)
-
sort
_ by! (24) -
to
_ a (12) -
to
_ ary (12) -
to
_ csv (12) -
to
_ h (19) - union (7)
- uniq (24)
- uniq! (24)
- unshift (12)
- zip (24)
- | (12)
検索結果
先頭5件
-
Array
# reverse! -> self (225.0) -
reverse は自身の要素を逆順に並べた新しい配列を生成して返します。 reverse! は自身を破壊的に並べ替えます。 reverse! は self を返します。
...順に並べた新しい配列を生成して返します。
reverse! は自身を破壊的に並べ替えます。
reverse! は self を返します。
//emlist[例][ruby]{
a = ["a", 2, true]
p a.reverse #=> [true, 2, "a"]
p a #=> ["a", 2, true] (変化なし)
a = ["a", 2,... -
Array
# to _ ary -> self (225.0) -
self をそのまま返します。
...
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#t... -
Array
# permutation(n = self . length) -> Enumerator (223.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
a = [1, 2, 3]
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(......した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e| result << e} # => [1,2,3]
result # => [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
//}
@see Array#combination, Array#repeated_permutation... -
Array
# <<(obj) -> self (221.0) -
指定された obj を自身の末尾に破壊的に追加します。
...の末尾に破壊的に追加します。
//emlist[例][ruby]{
ary = [1]
ary << 2
p ary # [1, 2]
//}
またこのメソッドは self を返すので、以下のように連続して
書くことができます。
//emlist[例][ruby]{
ary = [1]
ary << 2 << 3 << 4
p ary #=> [1, 2, 3, 4]
//......}
@param obj 自身に加えたいオブジェクトを指定します。Array#push と違って引数は一つしか指定できません。
@see Array#push... -
Array
# combination(n) {|c| block } -> self (221.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
a = [1, 2, 3, 4]
a.combination(1).to_a #=> [[1],[2],[3],[4]]
a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
a.combination(3).to......た配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # => [1,2,3,4]
result #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
//}
@see Array#permutation, Array#repeated_combination... -
Array
# product(*lists) { |e| . . . } -> self (221.0) -
レシーバの配列と引数で与えられた配列(複数可)のそれぞれから要素を1 個ずつとって配列とし,それらのすべての配列を要素とする配列を返します。
...ーバと引数で与えられた配列の長さのすべての積にな
ります。
@param lists 配列。複数指定可能。
//emlist[例][ruby]{
[1,2,3].product([4,5]) # => [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]
[1,2].product([1,2]) # => [[1,1],[1,2],[2,1],[2,2]]
[1,2].product([3,4......duct([]) # => []
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = []
[1,2,3].product([4,5]) {|e| a << e} # => [1,2,3]
a # => [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]
//}... -
Array
# repeated _ combination(n) { |c| . . . } -> self (221.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
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.repe......行して 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#combinat... -
Array
# repeated _ permutation(n) { |p| . . . } -> self (221.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
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).......ロックを実
行して 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
# fill {|index| . . . } -> self (217.0) -
すべての要素に val をセットします。
...とブロックの評価結果を値とします。
@param val 自身にセットしたいオブジェクトを指定します。
//emlist[例][ruby]{
a = [0, 1, 2, 3, 4]
a.fill(10)
p a #=> [10, 10, 10, 10, 10]
a = [0, 1, 2, 3, 4]
a.fill("a")
p a #=> ["a", "a", "a", "a", "a"]
a[0].capitalize!
p a...