るりまサーチ

最速Rubyリファレンスマニュアル検索!
2991件ヒット [101-200件を表示] (0.031秒)

別のキーワード

  1. each enumerator
  2. enumerator with_index
  3. enumerator with_object
  4. enumerator new

ライブラリ

モジュール

オブジェクト

検索結果

<< < 1 2 3 4 ... > >>

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...
<< < 1 2 3 4 ... > >>