657件ヒット
[1-100件を表示]
(0.058秒)
種類
- インスタンスメソッド (573)
- 文書 (51)
- モジュール関数 (11)
- 特異メソッド (11)
- 関数 (11)
ライブラリ
- ビルトイン (419)
- benchmark (11)
-
cgi
/ core (22) - csv (44)
- dbm (11)
- matrix (22)
- rake (33)
-
rubygems
/ platform (11) - set (11)
-
webrick
/ httputils (11)
クラス
-
ARGF
. class (66) - Array (154)
-
Benchmark
:: Tms (11) - CSV (11)
-
CSV
:: Table (33) - DBM (11)
-
Gem
:: Platform (11) - Hash (11)
- MatchData (55)
- Matrix (11)
- NilClass (11)
- Object (33)
-
Rake
:: FileList (33) - Range (12)
-
RubyVM
:: InstructionSequence (11) - Set (11)
- Time (11)
- Vector (11)
-
WEBrick
:: HTTPUtils :: FormData (11)
モジュール
-
CGI
:: QueryExtension :: Value (22) - Enumerable (44)
- Kernel (11)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - << (11)
- == (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - [] (44)
- combination (22)
- entries (6)
-
header
_ converters (11) -
max
_ by (44) - new (11)
- permutation (22)
-
rb
_ Array (11) - readlines (33)
-
repeated
_ combination (22) -
repeated
_ permutation (22) -
ruby 1
. 6 feature (11) - sample (44)
- tap (11)
-
to
_ ary (55) -
values
_ at (11) - メソッド呼び出し(super・ブロック付き・yield) (11)
検索結果
先頭5件
-
Array
# to _ a -> Array (39288.0) -
self を返します。ただし、Array のサブクラスのインスタンスに対して呼ばれた時は、 自身を Array に変換したものを返します。
...し、Array のサブクラスのインスタンスに対して呼ばれた時は、
自身を Array に変換したものを返します。
//emlist[例][ruby]{
class SubArray < Array; end
ary1 = Array([1, 2, 3, 4])
ary2 = SubArray([1, 2, 3, 4])
ary1.to_a # => [1, 2, 3, 4]
ary1.to_a.class......# => Array
ary2.to_a # => [1, 2, 3, 4]
ary2.to_a.class # => Array
//}
@see Array#to_ary... -
Array
# to _ ary -> self (27130.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
# sample(n) -> Array (21108.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...した場合に発生します。
@raise ArgumentError 引数 n に負の数を指定した場合に発生します。
//emlist[例][ruby]{
a = (1..10).to_a
p a.sample #=> 9
p a.sample #=> 10
p a.sample(3) #=> [1, 9, 3]
p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}... -
Array
# sample(n , random: Random) -> Array (21108.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...した場合に発生します。
@raise ArgumentError 引数 n に負の数を指定した場合に発生します。
//emlist[例][ruby]{
a = (1..10).to_a
p a.sample #=> 9
p a.sample #=> 10
p a.sample(3) #=> [1, 9, 3]
p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}... -
Array
# combination(n) -> Enumerator (21048.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...mbination(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_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of length 0
a.combination(5).to_a #=> [] :......た配列の各要素を引数としてブロックを実
行して 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
# combination(n) {|c| block } -> self (21048.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...mbination(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_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of length 0
a.combination(5).to_a #=> [] :......た配列の各要素を引数としてブロックを実
行して 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
# permutation(n = self . length) -> Enumerator (21048.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...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(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......permutation 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|......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
# permutation(n = self . length) { |p| block } -> self (21048.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...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(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......permutation 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|......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
# repeated _ combination(n) -> Enumerator (21042.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...ion(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.repeated_combination(4).to_a #=> [......2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
# [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
a.repeated_combination(0).to_a #=> [[]] # one combination of length 0
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを......して 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 (21042.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...ion(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.repeated_combination(4).to_a #=> [......2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
# [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
a.repeated_combination(0).to_a #=> [[]] # one combination of length 0
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを......して 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...