ライブラリ
- ビルトイン (410)
-
cgi
/ core (48) - csv (36)
- date (4)
- json (60)
-
minitest
/ unit (2) -
net
/ imap (60) - openssl (36)
- optparse (180)
- rake (24)
-
rake
/ rdoctask (24) -
rdoc
/ context (12) -
rubygems
/ config _ file (12) -
rubygems
/ dependency _ installer (24) -
rubygems
/ dependency _ list (12) -
rubygems
/ requirement (12) -
rubygems
/ source _ info _ cache (12) -
rubygems
/ specification (96) -
rubygems
/ user _ interaction (24) -
rubygems
/ version (24) - set (9)
-
shell
/ process-controller (18) - socket (48)
- tsort (12)
クラス
- Array (220)
- BasicSocket (12)
- CSV (24)
- Data (3)
- Date (2)
- DateTime (2)
-
Encoding
:: Converter (24) -
Gem
:: ConfigFile (12) -
Gem
:: DependencyInstaller (24) -
Gem
:: DependencyList (12) -
Gem
:: Requirement (12) -
Gem
:: SourceInfoCache (12) -
Gem
:: Specification (96) -
Gem
:: StreamUI (12) -
Gem
:: Version (24) -
JSON
:: State (48) - MatchData (2)
- Module (36)
-
Net
:: IMAP (12) -
Net
:: IMAP :: BodyTypeBasic (12) -
Net
:: IMAP :: BodyTypeMessage (12) -
Net
:: IMAP :: BodyTypeMultipart (12) -
Net
:: IMAP :: BodyTypeText (12) -
OpenSSL
:: X509 :: ExtensionFactory (36) - OptionParser (144)
-
OptionParser
:: ParseError (36) -
RDoc
:: Context (12) -
Rake
:: Application (12) -
Rake
:: RDocTask (24) -
Rake
:: Task (12) - Rational (24)
-
RubyVM
:: InstructionSequence (12) - Set (12)
-
Shell
:: ProcessController (18) - Socket (12)
-
Socket
:: Option (12) - Struct (6)
- Time (2)
- UDPSocket (12)
モジュール
-
CGI
:: QueryExtension (24) -
CGI
:: QueryExtension :: Value (24) - Enumerable (90)
-
Gem
:: UserInteraction (12) -
JSON
:: Generator :: GeneratorMethods :: Array (12) -
MiniTest
:: Assertions (2) - TSort (12)
キーワード
- [] (12)
-
accept
_ nonblock (12) - actions (12)
-
active
_ jobs (6) -
add
_ bindir (12) -
add
_ to (12) - args (24)
-
array
_ nl (12) -
array
_ nl= (12) -
assert
_ send (1) -
capture
_ io (1) -
cert
_ chain (12) -
choose
_ from _ list (24) - clone (12)
- coerce (12)
-
collect
_ concat (24) - combination (24)
- concat (33)
- converters (12)
- convpath (12)
-
create
_ ext _ from _ array (12) -
create
_ extension (24) -
deconstruct
_ keys (17) - dependencies (12)
-
dependent
_ gems (12) -
development
_ dependencies (12) - dup (12)
- extension (48)
- fetch (12)
-
find
_ spec _ by _ name _ and _ version (12) -
flat
_ map (24) -
header
_ converters (12) - install (12)
- intersection (18)
- jobs (6)
-
marshal
_ dump (24) -
marshal
_ load (12) -
module
_ function (36) - none? (42)
- one? (42)
-
option
_ list (12) - params (12)
- permutation (24)
-
primitive
_ errinfo (12) - recover (12)
-
recvfrom
_ nonblock (12) -
remove
_ by _ name (12) -
repeated
_ combination (24) -
repeated
_ permutation (24) - requirements (12)
-
response
_ handlers (12) -
runtime
_ dependencies (12) -
search
_ with _ source (12) - sendmsg (12)
-
set
_ backtrace (12) -
strongly
_ connected _ components (12) -
to
_ a (24) -
to
_ ary (12) -
to
_ csv (12) -
to
_ h (12) -
to
_ hash (12) -
to
_ json (12) -
top
_ level _ tasks (12) - union (7)
- unpack (12)
-
waiting
_ jobs (6)
検索結果
先頭5件
-
Array
# repeated _ combination(n) -> Enumerator (36125.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...ombination(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......epeated_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 (36125.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...ombination(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......epeated_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 _ permutation(n) -> Enumerator (36125.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...rmutation(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 permutation of le......ロックを実
行して 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 (36125.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...rmutation(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 permutation of le......ロックを実
行して 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
# none? -> bool (36101.0) -
ブロックを指定しない場合は、 配列のすべての 要素が偽であれば真を返します。そうでなければ偽を返します。
...none? {|word| word.length == 5} # => true
%w{ant bear cat}.none? {|word| word.length >= 4} # => false
%w{ant bear cat}.none?(/d/) # => true
[].none? # => true
[nil].none? # => true
[nil,false].none......? # => true
[nil, false, true].none? # => false
//}
@see Enumerable#none?... -
Array
# none? {|obj| . . . } -> bool (36101.0) -
ブロックを指定しない場合は、 配列のすべての 要素が偽であれば真を返します。そうでなければ偽を返します。
...none? {|word| word.length == 5} # => true
%w{ant bear cat}.none? {|word| word.length >= 4} # => false
%w{ant bear cat}.none?(/d/) # => true
[].none? # => true
[nil].none? # => true
[nil,false].none......? # => true
[nil, false, true].none? # => false
//}
@see Enumerable#none?... -
Array
# none?(pattern) -> bool (36101.0) -
ブロックを指定しない場合は、 配列のすべての 要素が偽であれば真を返します。そうでなければ偽を返します。
...none? {|word| word.length == 5} # => true
%w{ant bear cat}.none? {|word| word.length >= 4} # => false
%w{ant bear cat}.none?(/d/) # => true
[].none? # => true
[nil].none? # => true
[nil,false].none......? # => true
[nil, false, true].none? # => false
//}
@see Enumerable#none?... -
Array
# one? -> bool (36101.0) -
ブロックを指定しない場合は、 配列の要素のうち ちょうど一つだけが真であれば、真を返します。 そうでなければ偽を返します。
...][ruby]{
%w{ant bear cat}.one? {|word| word.length == 4} # => true
%w{ant bear cat}.one? {|word| word.length > 4} # => false
%w{ant bear cat}.one?(/t/) # => false
[ nil, true, 99 ].one? # => false
[ nil, true, false ].one?......# => true
[ nil, true, 99 ].one?(Integer) # => true
[].one? # => false
//}
@see Enumerable#one?... -
Array
# one? {|obj| . . . } -> bool (36101.0) -
ブロックを指定しない場合は、 配列の要素のうち ちょうど一つだけが真であれば、真を返します。 そうでなければ偽を返します。
...][ruby]{
%w{ant bear cat}.one? {|word| word.length == 4} # => true
%w{ant bear cat}.one? {|word| word.length > 4} # => false
%w{ant bear cat}.one?(/t/) # => false
[ nil, true, 99 ].one? # => false
[ nil, true, false ].one?......# => true
[ nil, true, 99 ].one?(Integer) # => true
[].one? # => false
//}
@see Enumerable#one?... -
Array
# one?(pattern) -> bool (36101.0) -
ブロックを指定しない場合は、 配列の要素のうち ちょうど一つだけが真であれば、真を返します。 そうでなければ偽を返します。
...][ruby]{
%w{ant bear cat}.one? {|word| word.length == 4} # => true
%w{ant bear cat}.one? {|word| word.length > 4} # => false
%w{ant bear cat}.one?(/t/) # => false
[ nil, true, 99 ].one? # => false
[ nil, true, false ].one?......# => true
[ nil, true, 99 ].one?(Integer) # => true
[].one? # => false
//}
@see Enumerable#one?... -
Array
# dup -> Array (33205.0) -
レシーバと同じ内容を持つ新しい配列を返します。
...レシーバと同じ内容を持つ新しい配列を返します。
clone は frozen singleton-class の情報も含めてコピーしますが、
dup は内容と tainted だけをコピーします。
またどちらのメソッドも要素それ自体のコピーはしません。
つまり......レシーバと同じ内容を持つ新しい配列を返します。
clone は frozen singleton-class の情報も含めてコピーしますが、
dup は内容だけをコピーします。
またどちらのメソッドも要素それ自体のコピーはしません。
つまり参照して... -
Array
# fetch(nth , ifnone) -> object (30125.0) -
nth 番目の要素を返します。
...nth 番目の要素を返します。
Array#[] (nth) とは nth 番目の要素が存在しない場合の振舞いが異
なります。最初の形式では、例外 IndexError が発生します。
二番目の形式では、引数 ifnone を返します。
三番目の形式では、ブロッ......@param ifnone 要素が存在しなかった場合に返すべき値を指定します。
@raise TypeError 引数 nth に整数以外の(暗黙の型変換が行えない)オブジェ
クトを指定した場合に発生します。
@raise IndexError 引数 ifnone もブロッ......なかった場合に発生します。
//emlist[例][ruby]{
a = [1, 2, 3, 4, 5]
begin
p a.fetch(10)
rescue IndexError => err
puts err #=> index 10 out of array
end
p a.fetch(10, 999) #=> 999
result = a.fetch(10){|nth|
print "#{nth} はありません。\n"
999
}
p result #=> 999
//}...