ライブラリ
- ビルトイン (2881)
クラス
-
ARGF
. class (249) - Array (228)
- Dir (142)
- Enumerator (167)
-
Enumerator
:: ArithmeticSequence (12) -
Enumerator
:: Chain (12) -
Enumerator
:: Lazy (167) -
Enumerator
:: Yielder (27) - File (22)
- Hash (166)
- IO (304)
- Module (33)
- Object (66)
- Range (33)
- StopIteration (11)
- String (237)
- Struct (44)
- Thread (55)
-
Thread
:: Queue (63) -
Thread
:: SizedQueue (36)
モジュール
- Enumerable (457)
- Kernel (79)
- ObjectSpace (44)
オブジェクト
- ENV (88)
キーワード
-
$ _ (11) -
$ stdin (11) - + (6)
- << (11)
- ARGF (11)
- ConditionVariable (9)
- DATA (11)
- EHOSTUNREACH (11)
- ENETUNREACH (11)
- Enumerable (11)
- Enumerator (11)
- Fiber (11)
- IO (11)
- Lazy (11)
- Proc (11)
- Queue (9)
- Range (11)
- ThreadGroup (11)
- [] (11)
-
append
_ features (11) - bytes (50)
- chars (50)
- children (14)
- chunk (33)
-
chunk
_ while (11) - clear (9)
- close (9)
- closed? (9)
- codepoints (50)
- collect! (22)
-
collect
_ concat (11) - count (33)
-
delete
_ if (22) - deq (18)
- drop (11)
-
each
_ byte (66) -
each
_ char (66) -
each
_ child (40) -
each
_ codepoint (66) -
each
_ cons (22) -
each
_ entry (22) -
each
_ grapheme _ cluster (14) -
each
_ index (22) -
each
_ key (44) -
each
_ line (132) -
each
_ object (44) -
each
_ pair (66) -
each
_ slice (22) -
each
_ value (44) -
each
_ with _ index (22) -
each
_ with _ object (22) - eager (5)
- entries (11)
-
enum
_ for (44) -
extend
_ object (11) - feed (11)
- filter! (12)
- first (22)
-
flat
_ map (11) - fnmatch (11)
- fnmatch? (11)
- foreach (66)
-
grapheme
_ clusters (14) - inject (33)
-
inplace
_ mode (11) -
instance
_ method (11) - invert (11)
- join (22)
-
keep
_ if (22) - lambda (17)
- length (9)
- lines (106)
- map! (22)
- new (73)
- next (11)
-
next
_ values (11) - pack (19)
- pass (11)
-
peek
_ values (11) - pop (18)
- pos (11)
- proc (18)
- reduce (33)
- rehash (11)
- reject! (22)
-
respond
_ to? (11) - result (11)
-
reverse
_ each (44) - rewind (11)
- select! (22)
- shift (18)
- size (9)
-
slice
_ after (42) -
slice
_ before (55) -
slice
_ when (21) - sum (33)
- take (11)
-
take
_ while (22) - tell (11)
- test (22)
-
to
_ a (11) -
to
_ enum (44) -
to
_ h (17) -
to
_ proc (5) - unpack (11)
- upto (11)
- value (11)
-
with
_ index (22) -
with
_ object (22) - yield (11)
- zip (44)
検索結果
先頭5件
-
IO
# each(rs , limit , chomp: false) -> Enumerator (26130.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...: 引数なし][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,......t[例: chomp = true][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(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so on..."
/... -
IO
# each(rs , limit , chomp: false) {|line| . . . } -> self (26130.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...: 引数なし][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,......t[例: chomp = true][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(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so on..."
/... -
ARGF
. class # each(rs = $ / ) -> Enumerator (26126.0) -
ARGFの現在位置から 1 行ずつ文字列として読み込み、それを引数として与えら れたブロックを実行します。
...フモード)。
@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 = $ / ) { |line| . . . } -> self (26126.0) -
ARGFの現在位置から 1 行ずつ文字列として読み込み、それを引数として与えら れたブロックを実行します。
...フモード)。
@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 (26126.0) -
ARGFの現在位置から 1 行ずつ文字列として読み込み、それを引数として与えら れたブロックを実行します。
...フモード)。
@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) { |line| . . . } -> self (26126.0) -
ARGFの現在位置から 1 行ずつ文字列として読み込み、それを引数として与えら れたブロックを実行します。
...フモード)。
@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... -
Array
# each -> Enumerator (26126.0) -
各要素に対してブロックを評価します。
...してブロックを評価します。
ブロックが与えられなかった場合は、自身と each から生成した
Enumerator オブジェクトを返します。
//emlist[例][ruby]{
[1, 2, 3].each do |i|
puts i
end
#=> 1
# 2
# 3
//}
@see Array#each_index, Array#reverse_each... -
Array
# each {|item| . . . . } -> self (26126.0) -
各要素に対してブロックを評価します。
...してブロックを評価します。
ブロックが与えられなかった場合は、自身と each から生成した
Enumerator オブジェクトを返します。
//emlist[例][ruby]{
[1, 2, 3].each do |i|
puts i
end
#=> 1
# 2
# 3
//}
@see Array#each_index, Array#reverse_each... -
IO
# each(limit) -> Enumerator (26124.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...: 引数なし][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(limit) {|line| . . . } -> self (26124.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...: 引数なし][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 (26124.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...: 引数なし][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 = $ / ) {|line| . . . } -> self (26124.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...: 引数なし][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 (26124.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...: 引数なし][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) {|line| . . . } -> self (26124.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...: 引数なし][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,... -
Range
# each -> Enumerator (26120.0) -
範囲内の要素に対して繰り返します。
...each は各要素の succ メソッドを使用してイテレーションするようになりました。
@raise TypeError succ メソッドを持たないクラスの範囲オブジェクトに対してこのメソッドを呼んだ場合に発生します。
//emlist[例][ruby]{
(10..15).each......{|n| print n, ' ' }
# prints: 10 11 12 13 14 15
(2.5..5).each {|n| print n, ' ' }
# raises: TypeError: can't iterate from Float
//}...