るりまサーチ

最速Rubyリファレンスマニュアル検索!
235件ヒット [1-100件を表示] (0.060秒)
トップページ > クエリ:enumerator[x] > クエリ:new[x] > クエリ:each_line[x]

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

ライブラリ

クラス

検索結果

<< 1 2 3 > >>

IO#each_line(limit, chomp: false) -> Enumerator (15236.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...を引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator
オブジェクトを返します。

テキスト読み込みメソッドとして動作します。

limit で最大読み込みバイト数...
...す。

//emlist[例: 引数なし][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: A...
...読み取りバイト数に 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 l...

IO#each_line(rs = $/, chomp: false) -> Enumerator (15236.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...を引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator
オブジェクトを返します。

テキスト読み込みメソッドとして動作します。

limit で最大読み込みバイト数...
...す。

//emlist[例: 引数なし][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: A...
...読み取りバイト数に 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 l...

IO#each_line(rs, limit, chomp: false) -> Enumerator (15236.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...を引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator
オブジェクトを返します。

テキスト読み込みメソッドとして動作します。

limit で最大読み込みバイト数...
...す。

//emlist[例: 引数なし][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: A...
...読み取りバイト数に 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 l...

IO#each_line(limit) -> Enumerator (15230.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...を引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator
オブジェクトを返します。

テキスト読み込みメソッドとして動作します。

limit で最大読み込みバイト数...
...す。

//emlist[例: 引数なし][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: A...
...読み取りバイト数に 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 l...

IO#each_line(rs = $/) -> Enumerator (15230.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...を引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator
オブジェクトを返します。

テキスト読み込みメソッドとして動作します。

limit で最大読み込みバイト数...
...す。

//emlist[例: 引数なし][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: A...
...読み取りバイト数に 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 l...

絞り込み条件を変える

IO#each_line(rs, limit) -> Enumerator (15230.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...を引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator
オブジェクトを返します。

テキスト読み込みメソッドとして動作します。

limit で最大読み込みバイト数...
...す。

//emlist[例: 引数なし][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: A...
...読み取りバイト数に 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 l...

StringIO#each_line(rs = $/) -> Enumerator (15217.0)

自身から 1 行ずつ読み込み、それを引数として与えられたブロックを実行します。

...連続する改行を行の区切りとみなします(パラグラフモード)。

@raise IOError 自身が読み取り不可なら発生します。

//emlist[例][ruby]{
require "stringio"
a = StringIO.new("hoge\nfoo\n")
a.each{|l| p l }
#=> "hoge\n"
# "foo\n"
//}

@see $/
@see IO#each_line...

IO#each_line(limit, chomp: false) {|line| ... } -> self (15136.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...を引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator
オブジェクトを返します。

テキスト読み込みメソッドとして動作します。

limit で最大読み込みバイト数...
...す。

//emlist[例: 引数なし][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: A...
...読み取りバイト数に 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 l...

IO#each_line(rs = $/, chomp: false) {|line| ... } -> self (15136.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...を引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator
オブジェクトを返します。

テキスト読み込みメソッドとして動作します。

limit で最大読み込みバイト数...
...す。

//emlist[例: 引数なし][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: A...
...読み取りバイト数に 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 l...

IO#each_line(rs, limit, chomp: false) {|line| ... } -> self (15136.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...を引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator
オブジェクトを返します。

テキスト読み込みメソッドとして動作します。

limit で最大読み込みバイト数...
...す。

//emlist[例: 引数なし][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: A...
...読み取りバイト数に 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 l...

絞り込み条件を変える

IO#each_line(limit) {|line| ... } -> self (15130.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...を引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator
オブジェクトを返します。

テキスト読み込みメソッドとして動作します。

limit で最大読み込みバイト数...
...す。

//emlist[例: 引数なし][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: A...
...読み取りバイト数に 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 l...

IO#each_line(rs = $/) {|line| ... } -> self (15130.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...を引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator
オブジェクトを返します。

テキスト読み込みメソッドとして動作します。

limit で最大読み込みバイト数...
...す。

//emlist[例: 引数なし][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: A...
...読み取りバイト数に 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 l...

IO#each_line(rs, limit) {|line| ... } -> self (15130.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...を引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator
オブジェクトを返します。

テキスト読み込みメソッドとして動作します。

limit で最大読み込みバイト数...
...す。

//emlist[例: 引数なし][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: A...
...読み取りバイト数に 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 l...

StringIO#each_line(rs = $/) {|line| ... } -> self (15117.0)

自身から 1 行ずつ読み込み、それを引数として与えられたブロックを実行します。

...連続する改行を行の区切りとみなします(パラグラフモード)。

@raise IOError 自身が読み取り不可なら発生します。

//emlist[例][ruby]{
require "stringio"
a = StringIO.new("hoge\nfoo\n")
a.each{|l| p l }
#=> "hoge\n"
# "foo\n"
//}

@see $/
@see IO#each_line...

Enumerator#next_values -> Array (9036.0)

「次」のオブジェクトを配列で返します。

...「次」のオブジェクトを配列で返します。

Enumerator
#next とほぼ同様の挙動をします。終端まで到達した場合は
StopIteration 例外を発生させます。

このメソッドは、
yield

yield nil
を区別するために使えます。

next メソッ...
...には影響を与えません。
ただし、 IO#each_line のようにおおもとの列挙メカニズムが副作用を
伴っている場合には影響があり得ます。

//emlist[例: next と next_values の違いを][ruby]{
o = Object.new
def o.each
yield
yield 1
yield 1, 2
yield...
...[1] 1
# yield 1, 2 [1, 2] [1, 2]
# yield nil [nil] nil
# yield [1, 2] [[1, 2]] [1, 2]
//}

@raise StopIteration 列挙状態が既に最後へ到達しているとき
@see Enumerator#next, Enumerator#peek, Enumerator#peek_values...

絞り込み条件を変える

NEWS for Ruby 2.6.0 (6180.0)

NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...NEWS for Ruby 2.6.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...numerable
* 新規メソッド
* Enumerable#chain はレシーバと引数のそれぞれの要素を順番にイテレートする
Enumerator
::Chain オブジェクトを返します。 15144
* 変更されたメソッド
* Enumerable#to_h はブロックを受け取り...
...パースするようになりました。
* BigDecimal.new はバージョン 2.0 で削除予定です。

* Pathname
* Pathname#read, Pathname#binread, Pathname#write,
Pathname#binwrite, Pathname#each_line, Pathname#readlines は
パスがパイプ文字 '|' で始ま...
<< 1 2 3 > >>