ライブラリ
クラス
-
ARGF
. class (252) - Addrinfo (24)
- Array (168)
- CSV (24)
- Dir (118)
- Enumerator (182)
-
Enumerator
:: ArithmeticSequence (14) -
Enumerator
:: Chain (14) -
Enumerator
:: Lazy (183) -
Enumerator
:: Yielder (30) -
Etc
:: Group (24) -
Etc
:: Passwd (24) -
Gem
:: SourceIndex (24) - Hash (158)
- IO (324)
- Integer (24)
- Matrix (196)
- Object (48)
- OpenStruct (24)
- Pathname (54)
- Prime (48)
-
Prime
:: PseudoPrimeGenerator (48) -
Psych
:: Nodes :: Node (24) -
REXML
:: Parent (72) - Range (33)
- StopIteration (12)
- String (112)
- StringIO (176)
- Struct (48)
- Vector (48)
-
Zlib
:: GzipReader (72)
モジュール
- Enumerable (252)
- ObjectSpace (48)
- TSort (132)
オブジェクト
- ENV (96)
-
Readline
:: HISTORY (24)
キーワード
- % (2)
- + (7)
- << (12)
- Enumerable (12)
- Fiber (12)
- Lazy (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - bytes (42)
- chars (42)
- chunk (36)
-
chunk
_ while (12) - codepoints (42)
- collect (24)
- collect! (38)
-
collect
_ concat (12) -
delete
_ if (24) - each2 (24)
-
each
_ byte (120) -
each
_ char (96) -
each
_ child (94) -
each
_ codepoint (96) -
each
_ cons (24) -
each
_ entry (30) -
each
_ grapheme _ cluster (16) -
each
_ index (48) -
each
_ key (48) -
each
_ line (216) -
each
_ object (48) -
each
_ pair (96) -
each
_ prime (24) -
each
_ slice (24) -
each
_ strongly _ connected _ component (44) -
each
_ strongly _ connected _ component _ from (44) -
each
_ value (48) -
each
_ with _ index (72) -
each
_ with _ object (24) - eager (6)
-
enum
_ for (48) - feed (12)
- filter! (14)
-
find
_ index (36) -
flat
_ map (12) - foreach (120)
- index (36)
-
keep
_ if (24) - lines (98)
- map (24)
- map! (38)
- new (31)
- next (12)
-
next
_ values (12) - optparse (12)
-
peek
_ values (12) - prime (12)
- reject! (24)
- result (12)
-
reverse
_ each (52) - rewind (12)
- select! (24)
-
slice
_ after (46) -
slice
_ before (60) -
slice
_ when (23) - step (3)
-
take
_ while (24) -
to
_ enum (48) -
to
_ proc (6) -
tsort
_ each (44) -
with
_ index (48) -
with
_ object (24) - yield (12)
検索結果
先頭5件
-
Matrix
# index(selector = :all) {|e| . . . } -> [Integer , Integer] | nil (14.0) -
指定した値と一致する要素の位置を [row, column] という配列で返します。 ブロックを与えた場合は各要素を引数としてブロックを呼び出し、 返り値が真であった要素の位置を返します。
...味は
Matrix#each を参照してください。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].index(&:even?) # => [0, 1]
Matrix[ [1,1], [1,1] ].index(1, :strict_lower) # => [1, 0]
//}
value を指定せず、さらにブロックを省略した場合、
Enumerator を返します... -
Matrix
# index(value , selector = :all) -> [Integer , Integer] | nil (14.0) -
指定した値と一致する要素の位置を [row, column] という配列で返します。 ブロックを与えた場合は各要素を引数としてブロックを呼び出し、 返り値が真であった要素の位置を返します。
...味は
Matrix#each を参照してください。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].index(&:even?) # => [0, 1]
Matrix[ [1,1], [1,1] ].index(1, :strict_lower) # => [1, 0]
//}
value を指定せず、さらにブロックを省略した場合、
Enumerator を返します... -
Matrix
# map {|x| . . . } -> Matrix (14.0) -
行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。
...適用を繰り返した結果を、要素として持つ行列を生成します。
ブロックがない場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
m = Matrix[[1, 2], [3, 4]]
p m.map { |x| x + 100 } # => Matrix[[101, 102], [103, 104]]
//}
@see Matrix#each... -
Enumerable
# take _ while {|element| . . . } -> Array (13.0) -
Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。
...クで評価します。
最初に偽になった要素の手前の要素までを配列として返します。
//emlist[例][ruby]{
e = [1, 2, 3, 4, 5, 0].each
e.take_while {|i| i < 3 } # => [1, 2]
//}
ブロックを省略した場合は Enumerator を返します。
@see Array#take_while... -
Fiber (12.0)
-
ノンプリエンプティブな軽量スレッド(以下ファイバーと呼ぶ)を提供します。 他の言語では coroutine あるいは semicoroutine と呼ばれることもあります。 Thread と違いユーザレベルスレッドとして実装されています。
...は内部イテレータを外部イテレータに変換する例です。
実際 Enumerator は Fiber を用いて実装されています。
//emlist[例:][ruby]{
def enum2gen(enum)
Fiber.new do
enum.each{|i|
Fiber.yield(i)
}
end
end
g = enum2gen(1..100)
p g.resume #=> 1
p... -
optparse (12.0)
-
コマンドラインのオプションを取り扱うためのライブラリです。
...します。ブロックの引数にはオプションが指定
されたことを示す true が渡されます(optionargの項も参照)。
Enumerator#each などと違い、OptionParser#on
メソッドが呼ばれた時点ではブロックは実行されません。あくまで登録される... -
prime (12.0)
-
素数や素因数分解を扱うライブラリです。
...クラスの機能を実現するための低水準のクラスも幾つか提供されています。
//emlist[例][ruby]{
require 'prime'
Prime.each(100) do |prime|
p prime #=> 2, 3, 5, 7, 11, ..., 97
end
2.prime? #=> true
4.prime? #=> false
//}
=== 生成器
Prime のメソッドは内部......は擬似素数の列挙方法の実装を提供します。また列挙状態や列挙の上界を記憶する機能もあります。
更に、 Enumerator と互換性のある外部イテレータでもあります。
状況に応じて適切な擬似素数生成アルゴリズムは異なるの... -
StringIO
# chars {|c| . . . } -> self (10.0) -
自身に含まれる文字を一文字ずつブロックに渡して評価します。
...自身に含まれる文字を一文字ずつブロックに渡して評価します。
自身は読み込み用にオープンされていなければなりません。
@raise IOError 自身が読み込み用にオープンされていない場合に発生します。
@see IO#each_char... -
StringIO
# codepoints {|codepoint| . . . } -> self (10.0) -
自身の各コードポイントに対して繰り返します。
...自身の各コードポイントに対して繰り返します。
@see IO#each_codepoint...