種類
- インスタンスメソッド (419)
- クラス (22)
- 定数 (11)
- 変数 (11)
ライブラリ
- ビルトイン (463)
クラス
-
ARGF
. class (141) - Enumerator (22)
-
Enumerator
:: Yielder (5) - IO (174)
- Object (11)
- String (55)
モジュール
- Enumerable (22)
- Kernel (11)
キーワード
-
$ stdin (11) - DATA (11)
- IO (11)
- Lazy (11)
-
inplace
_ mode (11) - lines (106)
- next (11)
-
next
_ values (11) - sum (33)
-
to
_ proc (5)
検索結果
先頭5件
-
String
# each _ line(rs = $ / ) -> Enumerator (32216.0) -
文字列中の各行に対して繰り返します。 行の区切りは rs に指定した文字列で、 そのデフォルト値は変数 $/ の値です。 各 line には区切りの文字列も含みます。
...で文字列を分割します
(つまり空行で分割します)。
@param rs 行末を示す文字列
//emlist[例][ruby]{
"aa\nbb\ncc\n".each_line do |line|
p line
end
# => "aa\n"
# => "bb\n"
# => "cc\n"
p "aa\nbb\ncc\n".lines.to_a # => ["aa\n", "bb\n", "cc\n"]
p "aa\n".lin... -
String
# each _ line(rs = $ / ) {|line| . . . } -> self (32216.0) -
文字列中の各行に対して繰り返します。 行の区切りは rs に指定した文字列で、 そのデフォルト値は変数 $/ の値です。 各 line には区切りの文字列も含みます。
...で文字列を分割します
(つまり空行で分割します)。
@param rs 行末を示す文字列
//emlist[例][ruby]{
"aa\nbb\ncc\n".each_line do |line|
p line
end
# => "aa\n"
# => "bb\n"
# => "cc\n"
p "aa\nbb\ncc\n".lines.to_a # => ["aa\n", "bb\n", "cc\n"]
p "aa\n".lin... -
String
# each _ line(rs = $ / , chomp: false) -> Enumerator (32216.0) -
文字列中の各行に対して繰り返します。 行の区切りは rs に指定した文字列で、 そのデフォルト値は変数 $/ の値です。 各 line には区切りの文字列も含みます。
...末を示す文字列
@param chomp true を指定すると各行の末尾から rs を取り除きます。
//emlist[例][ruby]{
"aa\nbb\ncc\n".each_line do |line|
p line
end
# => "aa\n"
# => "bb\n"
# => "cc\n"
p "aa\nbb\ncc\n".lines.to_a # => ["aa\n", "bb\n", "cc\n"]
p "aa\n".line... -
String
# each _ line(rs = $ / , chomp: false) {|line| . . . } -> self (32216.0) -
文字列中の各行に対して繰り返します。 行の区切りは rs に指定した文字列で、 そのデフォルト値は変数 $/ の値です。 各 line には区切りの文字列も含みます。
...末を示す文字列
@param chomp true を指定すると各行の末尾から rs を取り除きます。
//emlist[例][ruby]{
"aa\nbb\ncc\n".each_line do |line|
p line
end
# => "aa\n"
# => "bb\n"
# => "cc\n"
p "aa\nbb\ncc\n".lines.to_a # => ["aa\n", "bb\n", "cc\n"]
p "aa\n".line... -
ARGF
. class # each _ line(rs = $ / ) -> Enumerator (29242.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 _ line(rs = $ / ) { |line| . . . } -> self (29242.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 _ line(rs = $ / , limit) -> Enumerator (29242.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 _ line(rs = $ / , limit) { |line| . . . } -> self (29242.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... -
IO
# each _ line(limit , chomp: false) -> Enumerator (29236.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 _ line(limit , chomp: false) {|line| . . . } -> self (29236.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 _ line(rs = $ / , chomp: false) -> Enumerator (29236.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 _ line(rs = $ / , chomp: false) {|line| . . . } -> self (29236.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 _ line(rs , limit , chomp: false) -> Enumerator (29236.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..."
/...