クラス
- IO (297)
-
Zlib
:: GzipReader (22)
キーワード
-
$ stdin (11) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 3
. 0 . 0 (4) - NKF (11)
- each (66)
-
each
_ line (66) - lineno (11)
- lineno= (11)
- pos (11)
- pos= (11)
- readchar (11)
- readline (44)
- readlines (33)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) - sysread (11)
- tell (11)
- timeout (19)
- 制御構造 (11)
検索結果
先頭5件
-
IO
# gets(limit) -> String | nil (39139.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...il を返します。
テキスト読み込みメソッドとして動作します。
読み込んだ文字列を変数 $_ にセットします。
IO#readline との違いは EOF での振る舞いのみです。
limit で最大の読み込みバイト数を指定します。ただし
ファイ......みバイト数
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets......#=> nil
$_ #=> nil
@see $/, IO#readline... -
IO
# gets(limit , chomp: false) -> String | nil (39139.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...il を返します。
テキスト読み込みメソッドとして動作します。
読み込んだ文字列を変数 $_ にセットします。
IO#readline との違いは EOF での振る舞いのみです。
limit で最大の読み込みバイト数を指定します。ただし
ファイ......除きます。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets......#=> nil
$_ #=> nil
@see $/, IO#readline... -
IO
# gets(rs = $ / ) -> String | nil (39139.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...il を返します。
テキスト読み込みメソッドとして動作します。
読み込んだ文字列を変数 $_ にセットします。
IO#readline との違いは EOF での振る舞いのみです。
limit で最大の読み込みバイト数を指定します。ただし
ファイ......みバイト数
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets......#=> nil
$_ #=> nil
@see $/, IO#readline... -
IO
# gets(rs = $ / , chomp: false) -> String | nil (39139.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...il を返します。
テキスト読み込みメソッドとして動作します。
読み込んだ文字列を変数 $_ にセットします。
IO#readline との違いは EOF での振る舞いのみです。
limit で最大の読み込みバイト数を指定します。ただし
ファイ......除きます。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets......#=> nil
$_ #=> nil
@see $/, IO#readline... -
IO
# gets(rs , limit) -> String | nil (39139.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...il を返します。
テキスト読み込みメソッドとして動作します。
読み込んだ文字列を変数 $_ にセットします。
IO#readline との違いは EOF での振る舞いのみです。
limit で最大の読み込みバイト数を指定します。ただし
ファイ......みバイト数
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets......#=> nil
$_ #=> nil
@see $/, IO#readline... -
IO
# gets(rs , limit , chomp: false) -> String | nil (39139.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...il を返します。
テキスト読み込みメソッドとして動作します。
読み込んだ文字列を変数 $_ にセットします。
IO#readline との違いは EOF での振る舞いのみです。
limit で最大の読み込みバイト数を指定します。ただし
ファイ......除きます。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets......#=> nil
$_ #=> nil
@see $/, IO#readline... -
IO (38438.0)
-
基本的な入出力機能のためのクラスです。
...基本的な入出力機能のためのクラスです。
File::Constants は、File から IO へ移動しました。
===[a:m17n] 多言語化と IO のエンコーディング
IO オブジェクトはエンコーディングを持ちます。
エンコーディングの影響を受けるメ......と受けないメソッドがあります。
影響を受けるメソッドでは、IO のエンコーディングに従い読み込まれた文字列のエンコーディングが決定されます。
また IO のエンコーディングを適切に設定することにより、読み込み時...... IO のエンコーディングの影響をうけます。
詳しくは「io_encoding」を参照して下さい。
以下がテキスト読み込みメソッドです。
* IO.foreach
* IO.readlines
* IO#each_line
* IO#lines
* IO#gets
* IO#getc
* IO#ungetc
* IO#read
* IO#readchar
* IO#rea...... IO のエンコーディングの影響をうけます。
詳しくは「io_encoding」を参照して下さい。
以下がテキスト読み込みメソッドです。
* IO.foreach
* IO.readlines
* IO#each_line
* IO#gets
* IO#getc
* IO#ungetc
* IO#read
* IO#readchar
* IO#readline
* IO#... -
IO
# lineno -> Integer (21066.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
# each(limit , chomp: false) -> Enumerator (21064.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.lin......uby]{
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..."
//}
@see $/, IO#gets... -
IO
# each(limit , chomp: false) {|line| . . . } -> self (21064.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.lin......uby]{
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..."
//}
@see $/, IO#gets... -
IO
# each(rs = $ / , chomp: false) -> Enumerator (21064.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.lin......uby]{
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..."
//}
@see $/, IO#gets... -
IO
# each(rs = $ / , chomp: false) {|line| . . . } -> self (21064.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.lin......uby]{
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..."
//}
@see $/, IO#gets... -
IO
# each(rs , limit , chomp: false) -> Enumerator (21064.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.lin......uby]{
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..."
//}
@see $/, IO#gets... -
IO
# each(rs , limit , chomp: false) {|line| . . . } -> self (21064.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.lin......uby]{
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..."
//}
@see $/, IO#gets...