るりまサーチ

最速Rubyリファレンスマニュアル検索!
198件ヒット [1-100件を表示] (0.254秒)
トップページ > クラス:IO[x] > クエリ:_builtin[x] > クエリ:lineno[x] > ライブラリ:ビルトイン[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

キーワード

検索結果

<< 1 2 > >>

IO#lineno -> Integer (26122.0)

現在の行番号を整数で返します。実際には IO#gets が呼ばれた回数です。 改行以外のセパレータで gets が呼ばれた場合など、実際の行番号と異なる場合があります。

... IO#gets が呼ばれた回数です。
改行以外のセパレータで gets が呼ばれた場合など、実際の行番号と異なる場合があります。

@raise IOError 読み込み用にオープンされていなければ発生します。

f = File.new("testfile")
f.lineno...
...#=> 0
f.gets #=> "This is line one\n"
f.lineno #=> 1
f.gets #=> "This is line two\n"
f.lineno #=> 2

@see $....

IO#lineno=(number) (14116.0)

現在の行番号を number にセットします。 $. は次回の読み込みの時に更新されます。

...整数で指定します。

@raise IOError 読み込み用にオープンされていなければ発生します。

f = File.new("testfile")
f.gets #=> "This is line one\n"
$. #=> 1
f.lineno = 1000
f.lineno #=> 1000
$....

IO#rewind -> 0 (8025.0)

ファイルポインタを先頭に移動します。IO#lineno は 0 になります。

...先頭に移動します。IO#lineno は 0 になります。

@raise IOError 既に close されている場合に発生します。

f = File.new("testfile")
f.readline #=> "This is line one\n"
f.rewind #=> 0
f.lineno #=> 0
f.r...

IO#each(limit, chomp: false) -> Enumerator (8021.0)

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

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

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

テキスト読み込みメソ...
...

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

//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}"...
...半角カンマ、最大読み取りバイト数に 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:...

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

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

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

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

テキスト読み込みメソ...
...

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

//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}"...
...半角カンマ、最大読み取りバイト数に 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:...

絞り込み条件を変える

IO#each(rs = $/, chomp: false) -> Enumerator (8021.0)

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

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

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

テキスト読み込みメソ...
...

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

//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}"...
...半角カンマ、最大読み取りバイト数に 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:...

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

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

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

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

テキスト読み込みメソ...
...

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

//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}"...
...半角カンマ、最大読み取りバイト数に 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:...

IO#each(rs, limit, chomp: false) -> Enumerator (8021.0)

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

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

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

テキスト読み込みメソ...
...

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

//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}"...
...半角カンマ、最大読み取りバイト数に 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:...

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

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

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

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

テキスト読み込みメソ...
...

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

//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}"...
...半角カンマ、最大読み取りバイト数に 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:...

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

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

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

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

テキスト読み込みメソ...
...

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

//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}"...
...半角カンマ、最大読み取りバイト数に 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:...

絞り込み条件を変える

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

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

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

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

テキスト読み込みメソ...
...

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

//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}"...
...半角カンマ、最大読み取りバイト数に 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:...

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

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

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

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

テキスト読み込みメソ...
...

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

//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}"...
...半角カンマ、最大読み取りバイト数に 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:...
<< 1 2 > >>