ライブラリ
クラス
-
ARGF
. class (238) - Addrinfo (22)
- Array (154)
- Dir (106)
- Enumerator (167)
-
Enumerator
:: ArithmeticSequence (12) -
Enumerator
:: Chain (12) -
Enumerator
:: Lazy (167) -
Enumerator
:: Yielder (27) -
Etc
:: Group (22) -
Etc
:: Passwd (22) -
Gem
:: SourceIndex (22) - Hash (144)
- IO (304)
- Integer (22)
- Matrix (178)
- Object (44)
- OpenStruct (22)
- Pathname (48)
- Prime (44)
-
Prime
:: PseudoPrimeGenerator (44) -
Psych
:: Nodes :: Node (22) -
REXML
:: Parent (66) - Range (22)
- StopIteration (11)
- String (102)
- StringIO (166)
- Struct (44)
- Vector (44)
-
Zlib
:: GzipReader (66)
モジュール
- Enumerable (231)
- ObjectSpace (44)
- TSort (120)
オブジェクト
- ENV (88)
-
Readline
:: HISTORY (22)
キーワード
- + (6)
- << (11)
- Enumerable (11)
- Enumerator (11)
- Fiber (11)
- Lazy (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - bytes (42)
- chars (42)
- chunk (33)
-
chunk
_ while (11) - codepoints (42)
- collect (22)
- collect! (34)
-
collect
_ concat (11) -
delete
_ if (22) - each2 (22)
-
each
_ byte (110) -
each
_ char (88) -
each
_ child (84) -
each
_ codepoint (88) -
each
_ cons (22) -
each
_ entry (26) -
each
_ grapheme _ cluster (14) -
each
_ index (44) -
each
_ key (44) -
each
_ line (198) -
each
_ object (44) -
each
_ pair (88) -
each
_ prime (22) -
each
_ slice (22) -
each
_ strongly _ connected _ component (40) -
each
_ strongly _ connected _ component _ from (40) -
each
_ value (44) -
each
_ with _ index (66) -
each
_ with _ object (22) - eager (5)
-
enum
_ for (44) - feed (11)
- filter! (12)
-
find
_ index (33) -
flat
_ map (11) - foreach (88)
- index (33)
-
keep
_ if (22) - lines (98)
- map (22)
- map! (34)
- new (29)
- next (11)
-
next
_ values (11) - optparse (11)
-
peek
_ values (11) - prime (11)
- reject! (22)
- result (11)
-
reverse
_ each (44) - rewind (11)
- select! (22)
-
slice
_ after (42) -
slice
_ before (55) -
slice
_ when (21) -
take
_ while (22) -
to
_ enum (44) -
to
_ proc (5) -
tsort
_ each (40) -
with
_ index (44) -
with
_ object (22) - yield (11)
検索結果
先頭5件
-
Zlib
:: GzipReader # each(rs = $ / ) -> Enumerator (18256.0) -
IO クラスの同名メソッドIO#each, IO#each_lineと同じです。
...IO クラスの同名メソッドIO#each, IO#each_lineと同じです。
但し、gzip ファイル中に
エラーがあった場合 Zlib::Error 例外や
Zlib::GzipFile::Error 例外が発生します。
gzip ファイルのフッターの処理に注意して下さい。
gzip ファイルの......照
require 'zlib'
=begin
# hoge.gz がない場合は下記で作成できる。
Zlib::GzipWriter.open('hoge.gz') { |gz|
gz.puts 'hoge'
gz.puts 'fuga'
}
=end
Zlib::GzipReader.open('hoge.gz') { |gz|
gz.each { |line|
puts line
}
}
@see IO#each, IO#each_line... -
IO
# each(limit , chomp: false) -> Enumerator (18242.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...を引数として
与えられたブロックを実行します。
ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。
テキスト読み込みメソッドとして動作します。
limit で最大読み込みバイト数......: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on..."
//}
//e......ト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,... -
IO
# each(rs = $ / , chomp: false) -> Enumerator (18242.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...を引数として
与えられたブロックを実行します。
ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。
テキスト読み込みメソッドとして動作します。
limit で最大読み込みバイト数......: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on..."
//}
//e......ト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,... -
IO
# each(rs , limit , chomp: false) -> Enumerator (18242.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...を引数として
与えられたブロックを実行します。
ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。
テキスト読み込みメソッドとして動作します。
limit で最大読み込みバイト数......: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on..."
//}
//e......ト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,... -
ARGF
. class # each(rs = $ / ) -> Enumerator (18236.0) -
ARGFの現在位置から 1 行ずつ文字列として読み込み、それを引数として与えら れたブロックを実行します。
...て読み込み、それを引数として与えら
れたブロックを実行します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを生成し
て返します。
このメソッドはスクリプトに指定した引数(Object::ARGV を参照) をファ......フモード)。
@param limit 各行の最大の読み込みバイト数
例: ARGFの各ファイル名(最初に1回のみ)、行番号、内容を表示
ARGF.each_line do |line|
puts ARGF.filename if ARGF.lineno == 1
puts "#{ARGF.lineno}: #{line}"
end
@see IO#each, IO#each_line... -
ARGF
. class # each(rs = $ / , limit) -> Enumerator (18236.0) -
ARGFの現在位置から 1 行ずつ文字列として読み込み、それを引数として与えら れたブロックを実行します。
...て読み込み、それを引数として与えら
れたブロックを実行します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを生成し
て返します。
このメソッドはスクリプトに指定した引数(Object::ARGV を参照) をファ......フモード)。
@param limit 各行の最大の読み込みバイト数
例: ARGFの各ファイル名(最初に1回のみ)、行番号、内容を表示
ARGF.each_line do |line|
puts ARGF.filename if ARGF.lineno == 1
puts "#{ARGF.lineno}: #{line}"
end
@see IO#each, IO#each_line... -
IO
# each(limit) -> Enumerator (18236.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...を引数として
与えられたブロックを実行します。
ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。
テキスト読み込みメソッドとして動作します。
limit で最大読み込みバイト数......: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on..."
//}
//e......ト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,... -
IO
# each(rs = $ / ) -> Enumerator (18236.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...を引数として
与えられたブロックを実行します。
ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。
テキスト読み込みメソッドとして動作します。
limit で最大読み込みバイト数......: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on..."
//}
//e......ト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,... -
IO
# each(rs , limit) -> Enumerator (18236.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...を引数として
与えられたブロックを実行します。
ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。
テキスト読み込みメソッドとして動作します。
limit で最大読み込みバイト数......: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on..."
//}
//e......ト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3: ne three,... -
Array
# each -> Enumerator (18233.0) -
各要素に対してブロックを評価します。
...してブロックを評価します。
ブロックが与えられなかった場合は、自身と each から生成した
Enumerator オブジェクトを返します。
//emlist[例][ruby]{
[1, 2, 3].each do |i|
puts i
end
#=> 1
# 2
# 3
//}
@see Array#each_index, Array#reverse_each... -
Prime
. each(upper _ bound = nil , generator = EratosthenesGenerator . new) -> Enumerator (18231.0) -
Prime.instance.each と同じです。
...Prime.instance.each と同じです。
@param upper_bound 任意の正の整数を指定します。列挙の上界です。
nil が与えられた場合は無限に列挙し続けます。
@param generator 素数生成器のインスタンスを指定します。
@return ブ......ロックの最後に評価された値を返します。
ブロックが与えられなかった場合は、Enumerator と互換性のある外部イテレータを返します。
@see Prime#each... -
Matrix
# each(which = :all) -> Enumerator (18227.0) -
行列の各要素を引数としてブロックを呼び出します。
...upper 対角成分の上側
ブロックを省略した場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].each { |e| puts e }
# => prints the numbers 1 to 4
Matrix[ [1,2], [3,4] ].each(:strict_lower).to_a # => [3]
//}
@param which どの要素に......対してブロックを呼び出すのかを Symbol で指定します
@see Matrix#each_with_index, Matrix#map... -
Readline
:: HISTORY . each -> Enumerator (18227.0) -
ヒストリの内容に対してブロックを評価します。 ブロックパラメータにはヒストリの最初から最後までの内容を順番に渡します。
...sh("foo", "bar", "baz")
Readline::HISTORY.each do |s|
p s #=> "foo", "bar", "baz"
end
例: Enumerator オブジェクトを返す場合。
require "readline"
Readline::HISTORY.push("foo", "bar", "baz")
e = Readline::HISTORY.each
e.each do |s|
p s #=> "foo", "bar", "baz"
en...